Dual SIM card Android
Asked Answered
B

4

24

Has anyone had experience with programming the selection of the SIM card, when the phone uses a dual SIM adapter?

Thanks, STeN


Added later: I have found the MultiSim application on the Android Market, which has in its description written that "...Analog dual-sim-adapter users can switch their sim cards...", so is there some API in the Android SDK, which allows the SIM card switch/selection?

Bidget answered 10/3, 2011 at 3:32 Comment(2)
You can use Java reflection to get multiple SIM details. Here is sample how to do thatPalomo
You can try use MultiSim library: https://mcmap.net/q/88841/-android-dual-sim-card-apiTwofold
B
25

The current Android platform does not have support for multiple SIMs. A device with such support has been customized for this, so you will need to get information from that device's manufacturer for any facilities they have to interact with it.

Butterwort answered 10/3, 2011 at 5:49 Comment(3)
Hi, are you sure about it? How the the MultiSim application and ho the products like Hypercard 3G (2-phones-in-1.com/content/…) are working? If you will check the Hypercard 3G URL you will find there that the dual SIM package comes with Android and Symbian application which allows the SIM cards switching... Thanks for the answer.Bidget
@STeN: "Hi, are you sure about it?" -- @Butterwort is a Google employee and a core Android team member. "How the the MultiSim application and ho the products like Hypercard 3G (2-phones-in-1.com/content/…) are working?" -- I doubt that @Butterwort is the author of either of those apps and therefore cannot really comment on those apps. Those apps' developers presumably followed @hackbod's suggestion of contacting the device manufacturers. "so is there some API in the Android SDK, which allows the SIM card switch/selection?" -- no.Devilfish
Try using getDeviceId(int slotId) added in API level 23.Astragal
L
5

Since nobody mentioned it yet, Android finally has added official multisim support on Android 5.1.

But unless your app is only targeting that API (which is currently less than 0.5% of the market) you are on your own with the more obscure solutions mentioned in the other answers.

Lamarlamarck answered 13/4, 2015 at 17:8 Comment(0)
S
0

Please refer to this Dual Sim Android article. If you follow this direction, I think you can make it, even if current android api doesn't support dual sim card mobile devices.

Salina answered 24/11, 2013 at 7:25 Comment(0)
S
0

For SMS:

Assuming that you are developing the app for your own phone, and you are willing to go through the trouble of finding out the IDs (sim_id) assigned to each of your SIM cards (probably via checking the phone's log outputs, searching for sim_id, which was what I did), you can use the following code to set the default SIM for SMS sending:

int simId = <place desired SIM ID here>;
Intent simIntent = new Intent("android.intent.action.SMS_DEFAULT_SIM");
simIntent.putExtra("simid", simId);
sendBroadcast(simIntent);

Combined with some other UI prompt stuff (for actually 'picking' the preferred SIM), this should do the trick.

I'm not at all sure if this approach would work for you (although the code appears manufacturer-independent); I figured it out with trial and error on my Mlais MX28 (with a customized ROM). But it's still worth a shot, I suppose. :)

UPDATE: Strangely, the solution stopped working unexpectedly after a few updates to the app I was working on. But I came across another way (which seems to be more promising). (I believe this can be extended for other SIM selection scenarios as well, as the settings cache contains entries with names gprs_connection_sim_setting, voice_call_sim_setting, video_call_sim_setting and the like.)

ContentValues val = new ContentValues();
val.put("value", "here goes the preferred SIM ID");
getContentResolver().update(Uri.parse("content://settings/system"), val, "name='sms_sim_setting'", null);

(Unfortunately, this requires the android.permission.WRITE_SETTINGS permission.)

Sturmabteilung answered 13/4, 2015 at 17:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.