简体   繁体   English

如何从双SIM卡移动中获取两个IMEI号码?

[英]How can I get both IMEI numbers from dual SIM mobile?

How can I get both IMEI numbers from dual SIM mobile? 如何从双SIM卡移动中获取两个IMEI号码? Can anyone help me to resolve this problem. 任何人都可以帮我解决这个问题。

双卡手机的屏幕截图

Any information regarding SIM #2 (or any other then default SIM) is purely manufacturer dependent. 有关SIM#2(或任何其他默认SIM卡)的任何信息纯粹取决于制造商。 Android does not provide APIs for multi-SIM facility. Android不为多SIM设施提供API。 Android apis only support default SIM Card slot. Android apis仅支持默认SIM卡插槽。 You can contact Micromax (device manufacturer) if he can provide you apis to support his hardware component. 如果他能为您提供api支持他的硬件组件,您可以联系Micromax(设备制造商)。

You can try the following code it will help you. 您可以尝试以下代码来帮助您。

TelephonyManager manager= (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
try {
    Class<?> telephonyClass = Class.forName(manager.getClass().getName());
    Class<?>[] parameter = new Class[1];
    parameter[0] = int.class;
    Method getFirstMethod = telephonyClass.getMethod("getDeviceId", parameter);
    Log.d("SimData", getFirstMethod.toString());
    Object[] obParameter = new Object[1];
    obParameter[0] = 0;
    String first = (String) getFirstMethod.invoke(manager, obParameter);
    Log.d("IMEI ", "first :" + first);
    obParameter[0] = 1;
    String second = (String) getFirstMethod.invoke(manager, obParameter);
    Log.d("IMEI ", "Second :" + second);
} catch (Exception e) {
    e.printStackTrace();
}

And add the permission on menifest. 并在menifest上添加权限。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM