0

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?

Dalvinder Singh
  • 1,073
  • 1
  • 12
  • 19

1 Answers1

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