Android: Determine if running in emulator

if ("1".equals(SystemProperties.get("ro.kernel.qemu")) {
    // Emulator
}

[via]

5 Responses to “Android: Determine if running in emulator”

  1. mx123mobile Says:

    android 2.0 is great

  2. simon Says:

    i dont see a class called SystemProperties in android, and don’t see that property in System.getProperty()… where do you get this property?

  3. admin Says:

    This post could be clearer. It seems that SystemProperties is now available via the public API, i.e. you can only use it if you’re building against the actual source files, which you shouldn’t do unless you are building a custom Android.

    You can try to exec “getprop” though:

    http://stackoverflow.com/questions/2641111/where-is-android-os-systemproperties

  4. Alex Says:

    if(android.os.Build.MODEL.equals(“google_sdk”)){
    // emulator
    }else{
    //not emulator
    }

  5. Ted Says:

    boolean inEmulator = “generic”.equals(Build.BRAND);

    (Note that Build.MODEL is not “google_sdk” for Google’s Cupcake emulator (it’s “sdk”), and it’s other things for 3-rd party emulators (like Samsung’s Galaxy Tab and Sony Erikson’s EDK).

Leave a Reply