如何获得唯一的设备硬件ID在Android的?如何获得、硬件、设备、Android

2023-09-12 22:08:05 作者:眉间愁色.

如何获得在Android设备的唯一ID,不能在手机重设或操作系统的更新变化。

How to get device unique id in android which can not changed on phone reset or os update.

在此先感谢。

推荐答案

您检查这个博客在下面的链接

You check this blog in the link below

http://android-developers.blogspot.in/2011/03/identifying-app-installations.html

ANDROID_ID

ANDROID_ID

import android.provider.Settings.Secure;

private String android_id = Secure.getString(getContext().getContentResolver(),
                                                    Secure.ANDROID_ID); 

以上是从链路@ Is有一个独特的Andr​​oid设备的ID?

更具体地,Settings.Secure.ANDROID_ID。这是生成并存储在设备第一靴64位数量。 这是复位时,该设备擦拭

More specifically, Settings.Secure.ANDROID_ID. This is a 64-bit quantity that is generated and stored when the device first boots. It is reset when the device is wiped.

ANDROID_ID似乎是唯一的设备标识符一个不错的选择。有缺点:首先,它不是100%可靠的在Android 2.2之前(升级Froyo)的版本。此外,还有来自主要制造商,在每一个实例都有相同的ANDROID_ID已经至少有一个被广泛观测到的错误在一个受欢迎的手机。

ANDROID_ID seems a good choice for a unique device identifier. There are downsides: First, it is not 100% reliable on releases of Android prior to 2.2 ("Froyo"). Also, there has been at least one widely-observed bug in a popular handset from a major manufacturer, where every instance has the same ANDROID_ID.

下面的解决方案是不是一个很好的堂妹的价值生存设备擦除(工厂重置),因此你可能最终使一个讨厌的错误,当你的客户之一湿巾他们的设备,并把它传递到另一人

The below solution is not a good one coz the value survives device wipes ("Factory resets") and thus you could end up making a nasty mistake when one of your customers wipes their device and passes it on to another person.

您获得设备的使用IMEI号以下

You get the imei number of the device using the below

  TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
  telephonyManager.getDeviceId();

http://developer.android.com/reference/android/telephony/TelephonyManager.html#getDeviceId%28%29

添加这是明显的。

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>