How to obtain the android_id of a device? [duplicate]

放肆的年华 提交于 2019-12-03 11:06:12

问题


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?


回答1:


It's all in the Javadoc, as linked to by this question you edited 30 minutes before this one! :)
Is there a unique Android device ID?

The "Secure" part just means that apps can't write to it, only read. I seem to recall that this device ID isn't always present; it's populated by the Market as required, perhaps.




回答2:


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'"


来源:https://stackoverflow.com/questions/3354021/how-to-obtain-the-android-id-of-a-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!