Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the device ID on an Android emulator?

Is there a way to change the IMEI that will be returned by the emulator's TelephonyManager? Also, is there a way to change the ID returned by Settings.Secure.ANDROID_ID?

I use these IDs to distinguish my users from one another when storing their data on the server side. It would be nice if my QA team could change these IDs so that they are not all using the same set of user data.

like image 820
Neil Traft Avatar asked Jan 13 '11 22:01

Neil Traft


1 Answers

As far as Settings.Secure.ANDROID_ID goes, this should do the trick:

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

Where newid is usually the 16 hex digit code (i.e. don't append "Android_" to it).
I only tried this on the emulator. I imagine a real phone would need to be rooted first.

like image 86
Oren Avatar answered Sep 20 '22 11:09

Oren