2013年8月2日星期五

[ Android ] Android code to determine whether the current devicesimulator

 

 

 

[ Android ] Android code to determine whether the current device simulator

 

method is relatively simple, direct paste the code

 

 
  
  //判断当前设备是否是模拟器。如果返回TRUE,则当前是模拟器,不是返回FALSE 
public static boolean isEmulator(Context context){
try{
TelephonyManager tm
= (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String imei
= tm.getDeviceId();
if (imei != null && imei.equals("000000000000000")){
return true;
}
return (Build.MODEL.equals("sdk")) || (Build.MODEL.equals("google_sdk"));
}
catch (Exception ioe) {

}
return false;
}
 
 

2 条评论:

  1. method is relatively simple, direct paste the code

    回复删除
  2. Labeled jar package can not find the spring config...

    回复删除