1

Android 5.1 now has official support for Dual Sim phones, however there's not much currently available in the officially documented APIs. Does anybody know how, with a rooted phone, an app can switch either SIM1 or SIM 2 On and Off?

Floern
  • 33,559
  • 24
  • 104
  • 119
LairdPleng
  • 948
  • 3
  • 9
  • 28

1 Answers1

0

From the offical documentation mentioned the class SubscriptionManager,I just found something that could be switched:

DefaultVoice:

/** @hide */
    public void setDefaultVoiceSubId(int subId) {
        if (VDBG) logd("setDefaultVoiceSubId sub id = " + subId);
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
                iSub.setDefaultVoiceSubId(subId);
            }
        } catch (RemoteException ex) {
            // ignore it
        }
    }

DefaultSms:

/** @hide */
    public void setDefaultSmsSubId(int subId) {
        if (VDBG) logd("setDefaultSmsSubId sub id = " + subId);
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
                iSub.setDefaultSmsSubId(subId);
            }
        } catch (RemoteException ex) {
            // ignore it
        }
    }

DefaultData:

 /** @hide */
    public void setDefaultDataSubId(int subId) {
        if (VDBG) logd("setDataSubscription sub id = " + subId);
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
                iSub.setDefaultDataSubId(subId);
            }
        } catch (RemoteException ex) {
            // ignore it
        }
    }

But as you see,most of the methods of the class is @hide,that means it's not suitable to be public in the current version(Android 5.1.1/API Level 22).But you can also call them: https://devmaze.wordpress.com/2011/01/19/using-com-android-internal-part-5-summary-and-example/

And also some information for you from this:

Android dual SIM card API

Community
  • 1
  • 1
ifeegoo
  • 7,054
  • 3
  • 33
  • 38