private boolean checkEmulator1(){//基于电话号码,模拟器的电话号码是几个固定值
String[] known_numbers = {"15555215554","15555215556",
"15555215558","15555215560","15555215562","15555215564",
"15555215566","15555215568","15555215570","15555215572",
"15555215574","15555215576","15555215578","15555215580",
"15555215582","15555215584"};
TelephonyManager tm = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);
String number = tm.getLine1Number();
for(String i:known_numbers){
if(i.equals(number)){
return true;
}
}
return false;
}
private boolean checkEmulator2(){//基于SubscriberId
String subId = "310260000000000";
TelephonyManager tm = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);
String yourId = tm.getSubscriberId();
if(yourId.equals(subId)){
return true;
}else{
return false;
}
}
private boolean checkEmulator3(){//基于DeviceId,因为一般模拟器DeviceId为15个0
TelephonyManager pm = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);
String id = pm.getDeviceId();
if(id.equals("000000000000000")){
return true;
}else{
return false;
}
}
android判断模拟器的三种方法
最新推荐文章于 2024-09-12 15:52:42 发布
本文介绍了一种通过检查电话号码、SubscriberId及DeviceId来判断设备是否为模拟器的方法。对于电话号码,文章提供了一系列已知的模拟器电话号码进行比对;对于SubscriberId和DeviceId,则分别检查其是否为特定的模拟器标识符。
7398

被折叠的 条评论
为什么被折叠?



