0

I'm new to create something like that

but I wanna to stop people install my app on emulators especially bluestack.

when I googled it I found this and this but both of them failed with me and it still installing on bluestack.

tried to use this lib too but failed

so I hope anyone help me solve this

Zoe
  • 27,060
  • 21
  • 118
  • 148
Moustafa EL-Saghier
  • 1,721
  • 1
  • 13
  • 43
  • You can't technically block it from installing, and I highly recommend you don't spend time on this. Rooting the device (emulated or otherwise) offers a huge world of APK modifications, including removing emulator detection. – Zoe Mar 09 '19 at 08:53
  • but, what about Build architecture I mean exclude x86 x86_64 from compiling in android? – Moustafa EL-Saghier Mar 09 '19 at 21:18

1 Answers1

2

here is my idea, first why not try to check for SIM number and deny it whoever has none,

on Java:

TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber = telemamanger.getSimSerialNumber();
String getSimNumber = telemamanger.getLine1Number();

Enable permission in Manifest.xml

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

If that step fails because of User Modifications on their emulators try to check if the app is running on emulator,

    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);
}

If isEmulator() == true then the app should be closed.

Hope this helps!

Roshan
  • 786
  • 1
  • 9
  • 20
  • 1
    I suggest that an `AlertDialog` pops up before closing just to tell the user why the app is being closed – Sagar Mar 09 '19 at 01:55
  • Wouldn't the first one also block tablets? Seems like a horrible idea blocking an entire platform over emulator concerns. – Zoe Mar 09 '19 at 08:51
  • I need it not to install. I think about exclude x86 x86_64 from compiling in android what is ur opinion in it? – Moustafa EL-Saghier Mar 09 '19 at 21:19