lorem_stack
lorem_stack

Reputation: 111

Can apps recognize that they run in an android emulator?

im wondering how an android app might find out that it is running in an android emulator. Besides that, if the device is freashly booted, there are no user files and other applications installed. Are there any ressources on that topic?

Thanks in advance

Upvotes: 1

Views: 8690

Answers (1)

sissyphus_69
sissyphus_69

Reputation: 350

It is possible to get to know the details of the device your app is running on. From those details you can figure out, if the device is an Emulator or a physical device. Please go through the link below and see Fingerprint, Manufacturer, Device, Model, Product.

https://developer.android.com/reference/android/os/Build.html

For example: In your Splash Screen, if you put below code, then in your Logcat you should be seeing logs like below

`Log.e(TAG, "------------");
 Log.e(TAG, "Device Values");
 Log.e(TAG, "Fingerprint: " + Build.FINGERPRINT);
 Log.e(TAG, "Brand: " + Build.BRAND);
 Log.e(TAG, "Device: " + Build.DEVICE);
 Log.e(TAG, "Manufacturer: " + Build.MANUFACTURER);
 Log.e(TAG, "Model: " + Build.MODEL);
 Log.e(TAG, "Product: " + Build.PRODUCT);

 Real Device

 2020-03-15 20:46:07.136 32602-32602/com.utkarshnew.android E/NewSplashScreen:    ------------
 2020-03-15 20:46:07.136 32602-32602/com.utkarshnew.android E/NewSplashScreen:     Device Values
 2020-03-15 20:46:07.137 32602-32602/com.utkarshnew.android E/NewSplashScreen: Fingerprint: iBall/iBall_Slide_Cleo_S9/iBall_Slide_Cleo_S9:8.1.0/OPM2.1710/47218:user/release-keys
 2020-03-15 20:46:07.137 32602-32602/com.utkarshnew.android E/NewSplashScreen: Brand: iBall
 2020-03-15 20:46:07.137 32602-32602/com.utkarshnew.android E/NewSplashScreen: Device: iBall_Slide_Cleo_S9
 2020-03-15 20:46:07.137 32602-32602/com.utkarshnew.android E/NewSplashScreen: Manufacturer: iBall Slide
 2020-03-15 20:46:07.137 32602-32602/com.utkarshnew.android E/NewSplashScreen: Model: iBall Slide Cleo S9
 2020-03-15 20:46:07.137 32602-32602/com.utkarshnew.android E/NewSplashScreen: Product: iBall_Slide_Cleo_S9

 Emulator

 2020-03-15 20:53:44.725 6736-6736/com.utkarshnew.android E/NewSplashScreen: ------------
 2020-03-15 20:53:44.726 6736-6736/com.utkarshnew.android E/NewSplashScreen: Device Values
 2020-03-15 20:53:44.726 6736-6736/com.utkarshnew.android E/NewSplashScreen: Fingerprint: google/sdk_gphone_x86/generic_x86:10/QSR1.190920.001/5891938:user/release-keys
 2020-03-15 20:53:44.726 6736-6736/com.utkarshnew.android E/NewSplashScreen: Brand: google
 2020-03-15 20:53:44.726 6736-6736/com.utkarshnew.android E/NewSplashScreen: Device: generic_x86
 2020-03-15 20:53:44.726 6736-6736/com.utkarshnew.android E/NewSplashScreen: Manufacturer: Google
 2020-03-15 20:53:44.726 6736-6736/com.utkarshnew.android E/NewSplashScreen: Model: Android SDK built for x86
 2020-03-15 20:53:44.726 6736-6736/com.utkarshnew.android E/NewSplashScreen: Product: sdk_gphone_x86`

If you see the above logs, you'll see that for Emulator the Device value will come as Generic, whereas for a physical device, it'll show the name of the device model.

Also, please see these links

How can I detect when an Android application is running in the emulator?

How to check Android app is running in real device or virtual device?

Upvotes: 5

Related Questions