模拟器检测技巧

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

1.1 检测处理架构

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

1.2 检测产品工具集

public static boolean isEmulatorViaBuild(Context context){
    String model = PropertiesGet.getString("ro.product.model")
    if(!TextUtils.isEmpty(model) && model.toLowerCase().contains("sdk"))
        return true;

    String manufacture = PropertiesGet.getString("ro.product.manufactuer")
    if(!TextUtils.isEmpty(manufacture) && manufacture.toLowerCase().contains("unknown"))
        return true;

    String device = PropertiesGet.getString("ro.product.device")
    if(!TextUtils.isEmpty(device) && device.toLowerCase().contains("generic"))
        return true;

猜你喜欢

转载自blog.csdn.net/MusicDancing/article/details/132432549