Block emulators in android application

7.1k views Asked by At

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

There are 1 answers

3
Rohit5k2 On

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