How to check Android app is running in real device or virtual device? [duplicate]

谁都会走 提交于 2020-01-11 14:40:12

问题


I would like check real device user or virtual device user (like AVD, Genymotion, bluestack something like that)

My app is checked device id and rewarded. if abusing users are running app in virtual device, you now I'll be a beggar :(


回答1:


You can use checks like this:

public boolean isGenymotionEmulator(String buildManufacturer) {
    return buildManufacturer != null && 
           (buildManufacturer.contains("Genymotion") || buildManufacturer.equals("unknown"));
}

public boolean buildModelContainsEmulatorHints(String buildModel) {
    return buildModel.startsWith("sdk")
            || "google_sdk".equals(buildModel)
            || buildModel.contains("Emulator")
            || buildModel.contains("Android SDK");
}


来源:https://stackoverflow.com/questions/32732585/how-to-check-android-app-is-running-in-real-device-or-virtual-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!