Wednesday, September 29, 2010


My new app is online!
FFHound! is a FriendFeed client for android ;)

AppBrain

Wednesday, September 1, 2010

Detect if code runs into emulator

Working on my app i had needs to know if the code was running into emulator but Android doesn't have any API to detect it so i wrote a little function which returns 'true' if emulator is present:

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 ;)