当前位置:   article > 正文

模拟器检测技巧

模拟器检测

1. 常见的设备使用模拟器的检测技巧

1.1 检测处理架构

  1. private static boolean isEmulatorFromAbi(){
  2. String abi = PropertiesGet.getString("ro.product.cpu.abi");
  3. return !TextUtils.isEmpty(abi) && abi.contains("x86");
  4. }

1.2 检测产品工具集

  1. public static boolean isEmulatorViaBuild(Context context){
  2. String model = PropertiesGet.getString("ro.product.model")
  3. if(!TextUtils.isEmpty(model) && model.toLowerCase().contains("sdk"))
  4. return true;
  5. String manufacture = PropertiesGet.getString("ro.product.manufactuer")
  6. if(!TextUtils.isEmpty(manufacture) && manufacture.toLowerCase().contains("unknown"))
  7. return true;
  8. String device = PropertiesGet.getString("ro.product.device")
  9. if(!TextUtils.isEmpty(device) && device.toLowerCase().contains("generic"))
  10. return true;
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/932407
推荐阅读
相关标签
  

闽ICP备14008679号