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?
Asked
Active
Viewed 1,142 times
1 Answers
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:
-
These methods relate to switching default SIMs for actions, they don't enable me to turn a SIM on or off – LairdPleng Sep 10 '15 at 01:31