【Android】Android 代码判断当前设备是否为模拟器

方法比较简单,直接粘贴代码

 

  //判断当前设备是否是模拟器。如果返回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;
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
  • 2021-07-15
  • 2021-07-08
猜你喜欢
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案