How to obtain the android_id of a device?

Janusz picture Janusz · Jul 28, 2010 · Viewed 30.2k times · Source

Possible Duplicate:
Is there a unique Android device ID?

In the licensing documentation the android developers mention an easy way to more or less securely identify an android device. They are using android.Settings.Secure.ANDROID_ID.

They say they query the system settings for this. But they don't explain this any further.

How do I obtain the android_id and do I need special permissions for doing so?

Answer

Habbah picture Habbah · Dec 6, 2012
adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT value FROM secure WHERE name='android_id'"

The android id is changeable with a rooted phone... Insert a android id with:

adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "UPDATE secure SET value='IDHERE' WHERE name='android_id'"