I would like to block my app from running in emulators such as bluestacks/youwave etc. Is there anyway I can block or even identify if the user is running in bluestacks/youwave? My app has logging in features. So it users the server as well, so I dont mind blocking the user at clientside/serverside as long as he's blocked. Any help would be greatly appreciated.
Asked
Active
Viewed 6,429 times
4
-
1Check the various values from the `Build` class to see if these emulators have anything distinctive. – CommonsWare Nov 20 '12 at 00:01
-
@CommonsWare Thanks for that. After a bit of research, it looks like bluestacks emulator returns null for 'TelephonyManager.getline1number()' . Is that advisable? Would it be blocking the app from many other devices other than tablets? – user1837278 Nov 20 '12 at 07:04
-
"Is that advisable?" -- no, because lots of devices do that. `getLine1Number()` is perhaps the least reliable method in all of Android. Again, I sincerely hope that Bluestacks and kin put something in the `Build` values to identify themselves. – CommonsWare Nov 20 '12 at 11:53
-
@CommonsWare Yeah, it sucks that they have made it look exactly like a samsung galaxy device. Messaged them asking for help but no reply. It even has galaxy's certificates installed in it. Is there any method I can block all non phone devices? like tablets etc? I wouldnt mind that as well if it blocks bluestacks – user1837278 Nov 20 '12 at 18:09
-
"It even has galaxy's certificates installed in it." -- that's a bit surprising. "Is there any method I can block all non phone devices? like tablets etc?" -- see what `PackageManager` and `hasSystemFeature(PackageManager.FEATURE_TELEPHONY)` returns. That will return `false` for devices lacking telephony capability. – CommonsWare Nov 20 '12 at 18:19
-
@CommonsWare It returned true for 'hasSystemFeature(PackageManager.FEATURE_TELEPHONY)' . Any other suggestions? btw..thanks a lott for taking your time to help us out :) Really appreciate it. – user1837278 Nov 21 '12 at 05:40
-
Just curious... Why do you want to block emulators specifically? – user56reinstatemonica8 Jan 23 '13 at 22:22
-
3It's likely because users use emulators to 'cheat' by creating fake users for referal rewards – Jeremy Jul 09 '13 at 22:00
-
hi ...did u find any reliable solution for this ? – Nirav Bhandari Jul 15 '15 at 13:46
1 Answers
2
1: Check for SIM Number and deny access to whoever has none. This includes tablets since you stated that you wanted to block them.
Java:
TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String getSimSerialNumber = telemamanger.getSimSerialNumber();
String getSimNumber = telemamanger.getLine1Number();
Manifest.xml:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
2. Emulator kernel check.
If #1 fails because of user modifications to their emulator, check if (ro.kernel.qemu == 1). This property is read-only and will always return 1 for emulators.

smoothBlue
- 203
- 4
- 12