Identifying an Emulator in Android 2.2

Previously, I had advised people to check to see if ANDROID_ID was null if they wanted to determine if their device was an emulator. That had two flaws:

  1. ANDROID_ID is stored in a system SQLite database, so a rooted device might somehow hack in a null value.

  2. ANDROID_ID is actually tied into Google accounts and such, and now you can actually set up a Google account on your Android 2.2 device.

As such, ANDROID_ID is no longer null in the emulator.

Another suggestion from StackOverflow that seems to work is:

"google_sdk".equals(android.os.Build.PRODUCT);

This seems to hold true for the 1.5, 1.6, 2.1, and 2.2 emulators, which means it is a promising technique.