Block emulators in android application

情到浓时终转凉″ 提交于 2020-01-15 11:17:12

问题


For the security purpose, I want to block emulator to use my app. I do not want my app to be installed on any emulator like genymotion,bluestack,droidx etc...

I have an app where we have offer wall which contains no of android app, that use can install and earn points. Once they earn some points then they can withdraw using paypal account.

Now the problem is some of the users are installing it via proxy or emulator.they are earning money like anything by using proxy or emulator..

Please help..I am in big trouble..


回答1:


I think this would work. When your app starts check this method. If it returns true, exit your app. Otherwise continue. It won't prevent from installing but sure would prevent from running.

 public static boolean isRunningOnEmulator()
 {
    boolean result=
        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");
    if(result)
        return true;

    result|=Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic");

    if(result)
        return true;

    result|="google_sdk".equals(Build.PRODUCT);

    return result;
}

More information is here



来源:https://stackoverflow.com/questions/30777127/block-emulators-in-android-application

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