I expect that my android application is allowed to install only on real device, and android-emulator can't.How can I limit my android application installed on real device only ? Thanks for any replies.
Asked
Active
Viewed 840 times
3
-
1[This can be helpful for you](http://stackoverflow.com/q/2799097/593709) – Adil Soomro Jan 10 '12 at 08:18
-
its depend on app memory and total memory of device – Samir Mangroliya Jan 10 '12 at 08:26
-
Can you tell us why would you need such a requirement? Just curious. – san Jan 10 '12 at 08:29
2 Answers
0
Unfortunately you cannot stop people from installing in emulator, but if you have Google Licensing installed it will make sure that it does not run on unlicensed devices.

the100rabh
- 4,077
- 4
- 32
- 40
0
There's one way how to handle it. Just check device id (IMEI code). For emulator it's always null
, so you can define either someone tries to launch it in real device or in emulator.
TelephonyManager tm=(TelephonyManager )activity.getSystemService(Context.TELEPHONY_SERVICE);
if(tm==null || !this.hasTelephony())
{
Log.v(TAG, "Can't get telephony service. Forcing shut down!");
return false;
}
String deviceId=tm.getDeviceId();
if(deviceId==null || deviceId.length() < 2)
{
Log.v(TAG, "Looks like emulator - bail out!");
Toast.makeText(activity, "This special version not intended to run in this device!", 5000).show();
return false;
}

Barmaley
- 16,638
- 18
- 73
- 146
-
Actually the imei/device id for our emulator is 000000000.... I think 15 zeros overall. So null or two zeros wont work. – AgentKnopf Jan 03 '13 at 10:49