getDeviceId() 返回十六进制...为什么?
我只为英国构建了一个应用程序,它使用设备 ID 来唯一标识设备。该应用程序仅添加到特定手机(而不是通过市场),因此对谁拥有该应用程序的控制相当高。
我们现在从设备获取数据,发现一些设备 ID 是十六进制的,而不是纯数字(IMEI 应该是)。
某些数据返回绝对正确,而某些数据似乎是无效的十六进制。
由于某些数据是正确的,欧洲设备是否可以通过任何方式返回 MEID 号码,因为这似乎就是正在发生的情况。
返回设备 ID 的代码(包含适当的权限):
{
tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getDeviceId();
}
有什么想法吗?
I've built an app for the UK only which uses the device ID to uniquely identify the device. The app is only being added to specific handsets (not via the market) so the control of who has the app is quite high.
We're now getting the data back from the devices, and finding that some of the device IDs are hexadecimal and not purely digits (as IMEI should be).
Some of the data is returning absolutely correctly and some appears to be invalid hexadecimal.
Because some of the data is correct, is there any way that European devices can return MEID numbers or not, because that appears to be what is happening.
Code to return device id (with appropriate permissions included):
{
tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getDeviceId();
}
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,该方法会返回 IMEI、MEID 或 ESN,具体取决于手机。
http://developer.android.com/reference/ android/telephony/TelephonyManager.html#getDeviceId%28%29
Yes, the method returns an IMEI, MEID or ESN depending on the phone.
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getDeviceId%28%29