无法在Samsung Dual Android手机中获取sim2的Sim Card详细信息(Sim序列号)

时间:2014-05-28 08:04:27

标签: java android samsung-mobile telephonymanager sim-card

我正在尝试在三星双手机(三星Gt-S6802)中获取sim 1和sim 2的SIM卡详细信息,我能够获得sim 1的详细信息但是对于sim 2我得到一个空值。< / p>

我正在使用Java反射方法获取两个Sim序列号。

我使用了这个教程Android : Check whether the phone is dual SIM

如果你知道任何解决方法,请告诉我。

由于

1 个答案:

答案 0 :(得分:1)

如果某人仍然有兴趣知道答案,那么API&gt; = 22

// you may ignore TelephonyManager if you don't want to get the IMEI
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

SubscriptionManager subscriptionManager = SubscriptionManager.from(getApplicationContext());
List<SubscriptionInfo> subsList = subscriptionManager.getActiveSubscriptionInfoList();

for (SubscriptionInfo subscriptionInfo : subsList ) {
    // get IMEI
    int simSlotIndex = subscriptionInfo.getSimSlotIndex();
    String imei = telephonyManager.getImei(simSlotIndex);

    // get serial number
    String serialNumber = subscriptionInfo.getIccId();

    // get line number
    String lineNumber = subscriptionInfo.getNumber();
}