public static boolean isEmulator() {
String id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
boolean emulator = TextUtils.isEmpty(id);
if (!emulator) {
emulator = id.toUpperCase().equals("9774D56D682E549C");
}
return emulator;
}
ANDROID_ID is null on 'old' emulators, since 2.2 the id is always '9774D56D682E549C'.
Hope this help ;)
Actually Droid 2 and some other customized 2.2 rom return the same magic '9774D56D682E549C', so there is no precise way to detect it's emulator or not
ReplyDeleteIt's actually a bug and all the Froyo devices that i've used respond to the same Android_id
ReplyDeletehttp://code.google.com/p/android/issues/detail?id=10603