- Where is the
android_id value stored?
On Android 5 and earlier this was stored in
secure namespace of device Settings. So you can extract using:
~$ content query --uri content://settings/secure --projection value --where "name='android_id'"
~$ settings get secure android_id
Or directly read the
secure table of
settings.db database file. For device owner:
~# sqlite3 /data/user/0/com.android.providers.settings/databases/settings.db 'select * from secure where name="android_id"'
Since Android 6 settings are saved in
xml files. For device owner:
~# grep android_id /data/system/users/0/settings_secure.xml
Since Android 8,
android_id is "unique to each combination of app-signing key, user, and device" so as to deny "developers the ability to track users across multiple applications". These unique IDs are stored in
android_id value init, the first time set the value?
- Which case does the
android_id value change?
android_id "is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device" unless a factory reset is performed which clears all settings.
On Android 8+ the app specific
android_id "value may change if a factory reset is performed on the device or if an APK signing key changes".
Keeping all in view it doesn't seem a good idea to build a