标签:
加入权限设置
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
//判断当前设备是否是模拟器。如果返回TRUE,则当前是模拟器,不是返回FALSE
private static boolean isEmulator(Context context){
try{
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String imei = tm.getDeviceId();
if (imei != null && (imei.equals("000000000000000") || imei.equals("098675694745850"))){
return true;
}
return (Build.MODEL.equals("sdk")) || (Build.MODEL.equals("google_sdk"));
}catch (Exception ioe) {
}
return false;
}
标签:
原文地址:http://www.cnblogs.com/-long/p/4330029.html