2011-01-13 202 views
5

有没有办法改变模拟器的TelephonyManager将返回的IMEI?另外,有没有办法改变Settings.Secure.ANDROID_ID返回的ID?更改Android模拟器上的设备ID?

我在服务器端存储他们的数据时使用这些ID区分我的用户。如果我的QA团队可以更改这些ID,以便它们不都使用相同的一组用户数据,那将会很好。

回答

2

我还没有尝试过,但this page概述了一种涉及手动修改emaultor.exe文件的方法。这看起来很简单,但你必须为每个QA团队成员创建一个单独的模拟器。

+0

它不是最好的方式,但它是唯一的出路!在他的后续[post](http://blog.codepainters.com/2010/11/20/android-emulator-patch-for-configurable-imei-imsi-and-sim-card-serial-number/)他提供了一个补丁来使其可配置(当然,需要重新编译仿真器)。 – 2011-01-18 23:25:47

+0

Upvoting由于链接到我的博客:)请注意,我将博客移动到http://blog.codepainters.com,尽情享受吧! – 2012-11-13 10:16:19

2

至于Settings.Secure.ANDROID_ID去,这应该做的伎俩:

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

哪里newid通常是16进制数字代码(即不追加 ”Android_“ 的话)。我只是想这对我模拟器想象一个真正的手机将需要先扎根

1

查询android_id在亚行外壳使用这个命令:。

settings get secure android_id

变化android_id在亚行外壳使用这个命令:

settings put secure android_id xxxxxxxxxxxxxxxx

0

答案ZYC ZYC是最好的一个,直到安卓7.1.1(25)。在Android android_id的8条规则作为官方开发者文档中描述了变化: https://android-developers.googleblog.com/2017/04/changes-to-device-identifiers-in.html

In O, Android ID (Settings.Secure.ANDROID_ID or SSAID) has a different value for each app and each user on the device. Developers requiring a device-scoped identifier, should instead use a resettable identifier, such as Advertising ID, giving users more control. Advertising ID also provides a user-facing setting to limit ad tracking. Additionally in Android O: The ANDROID_ID value won't change on package uninstall/reinstall, as long as the package name and signing key are the same. Apps can rely on this value to maintain state across reinstalls. If an app was installed on a device running an earlier version of Android, the Android ID remains the same when the device is updated to Android O, unless the app is uninstalled and reinstalled. The Android ID value only changes if the device is factory reset or if the signing key rotates between uninstall and reinstall events. This change is only required for device manufacturers shipping with Google Play services and Advertising ID. Other device manufacturers may provide an alternative resettable ID or continue to provide ANDROID ID.

相关问题