判断Android App 运行环境时模拟器还是实机

摘抄自其他app的代码,用来检测是模拟器还是实机的。

public static boolean isEmulator() {
        return Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith("unknown") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion") || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) || "google_sdk".equals(Build.PRODUCT);
    }

Tip

完全可以通过Xposed框架进行hook,来进行规避这个检测问题;

完美!

你可能感兴趣的:(判断Android App 运行环境时模拟器还是实机)