I am working on a project where I need to know app is running on android mobile device or android desktop device. I have installed Android-x86 OS on my PC and I am making app for Android-x86. How to know our code is running on android mobile device or android desktop device?
Asked
Active
Viewed 250 times
0
-
Do you mean real device or emulator ? – SergeyBukarev Jul 16 '18 at 18:04
-
1real device, I have install Android OS on my PC – Dalvinder Singh Jul 16 '18 at 18:06
1 Answers
0
Try this
public boolean isGenymotionEmulatorDevice(String manufacturer) {
return manufacturer.toUpperCase().contains("GENYMOTION");
}
public boolean isGoogleEmulatorDevice(String model) {
String modelUpper = model.toUpperCase();
return modelUpper.contains("GOOGLE_SDK")
|| modelUpper.contains("SDK")
|| modelUpper.contains("EMULATOR");
}
Usage
boolean isGenymotionEmulator = isGenymotionEmulatorDevice(Build.MANUFACTURER)
boolean isGoogleEmulator = isGoogleEmulatorDevice(Build.MODEL)

SergeyBukarev
- 1,478
- 1
- 12
- 19
-
Hi @sergeyBukarev, I am not talking about emulator. I install android Android-x86 OS on my PC, So how i configuration of Android mobile OS differentiate from Android desktop OS? – Dalvinder Singh Jul 17 '18 at 09:34
-
OK. Are there any special notes in the Build.MODEL or Build.MANUFACTURER variable? – SergeyBukarev Jul 17 '18 at 09:36
-
Please google for Android-x86 OS. Then you can understand my question easily. – Dalvinder Singh Jul 17 '18 at 09:44