Android 5.1开关双sim卡无线电开关

时间:2015-09-09 11:13:18

标签: android android-5.0-lollipop dual-sim

Android 5.1现在正式支持Dual Sim手机,however there's not much currently available in the officially documented APIs。有人知道,使用root手机,应用程序可以打开和关闭SIM1或SIM 2吗?

1 个答案:

答案 0 :(得分:0)

从提到课程SubscriptionManager的官方文档中,我发现了一些可以切换的内容:

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
        }
    }

但是如您所见,该类的大多数方法都是@hide,这意味着它不适合在当前版本中公开(Android 5.1.1 / API Level 22)。但是你也可以打电话给他们: https://devmaze.wordpress.com/2011/01/19/using-com-android-internal-part-5-summary-and-example/

还有一些信息可供你使用:

Android dual SIM card API