如何在android中获取第二个sim的信息

时间:2015-11-03 12:16:34

标签: android android-permissions dual-sim

通过使用以下方法,我将获得sim one的信息

 TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
            // Get the SIM country ISO code
            String simCountry = telephonyManager.getSimCountryIso();
            Log.e("Show:", simCountry);
            // Get the operator code of the active SIM (MCC + MNC)
            String simOperatorCode = telephonyManager.getSimOperator();
            Log.e("Show:", simOperatorCode);
            // Get the name of the SIM operator
            String simOperatorName = telephonyManager.getSimOperatorName();
            Log.e("Show:", simOperatorName);
            // Get the SIM’s serial number
            String simSerial = telephonyManager.getSimSerialNumber();
            Log.e("Show:", simSerial);
            // Get the phone number
            String mPhoneNumber = telephonyManager.getLine1Number();
            Log.e("Show:", mPhoneNumber);

如何获取双卡手机的第二张SIM卡的信息?

            // Get the phone number
            String mPhoneNumber = telephonyManager.getLine1Number();
            Log.e("Show:", mPhoneNumber);

在某些设备上工作

许可:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

那我该怎么办?有错误吗?

1 个答案:

答案 0 :(得分:0)

来自Android API 22 SubscriptionMananger可用 你只需要打电话

SubscriptionManager.from(context).getActiveSubscriptionInfo(1)

获取有关第二张SIM卡的信息