/**
* 获取双卡手机的两个卡的IMSI 需要 READ_PHONE_STATE 权限
*
* @param context
* 上下文
* @return 下标0为一卡的IMSI,下标1为二卡的IMSI
*/
public static String[] getIMSI(Context context) {
// 双卡imsi的数组
String[] imsis = new String[2];
try {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
// 先使用默认的获取方式获取一卡IMSI
imsis[0] = tm.getSubscriberId();
// 然后进行二卡IMSI的获取,默认先获取展讯的IMSI
try {
Method method = tm.getClass().getDeclaredMethod(
"getSubscriberIdGemini", int.class);
method.setAccessible(true);
// 0 表示 一卡,1 表示二卡,下方获取相同
imsis[1] = (String) method.invoke(tm, 1);
} catch (Exception e) {
// 异常清空数据,继续获取下一个
imsis[1] = null;
}
if (imsis[1] == null || "".equals(imsis[1])) { // 如果二卡为空就获取mtk
try {
Class<?> c = Class
.forName(&#
获取双卡手机的两个卡的IMSI
最新推荐文章于 2022-05-20 19:59:51 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)