Android Unique values

Source: Internet
Author: User

1.IMEI

Telephonymanager tm= (Telephonymanager) This.getsystemservice (Context.telephony_service); String IMEI = Tm.getdeviceid (); LOG.V ("Ola_log", "IMEI:" + IMEI);

Permissions:

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

Description: The IMEI value of the phone

Cons: Some of the only Wifi tablet, the obtained value is NULL

2.android_id

String android_id = secure.getstring (This.getbasecontext (). Getcontentresolver (), secure.android_id); LOG.V ("Ola_log", "android_id:" + android_id);

Description: Serial number generated when the device first starts

Cons: Online Some people say that some brands will have a duplicate Android ID value, when back to factory settings, theAndroid ID value will change

3.wifi_mac

Wifimanager Wifimanager = (wifimanager) this.getsystemservice (Context.wifi_service); Wifiinfo wifiinfo = Wifimanager.getconnectioninfo (); LOG.V ("Ola_log", "MacAddress:" + wifiinfo.getmacaddress ());

Permissions:

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

Description: Wifi for MAC

Cons: Some brands, no Wifi can not get MAC value

4.build.serial

String buildserial = Android.os.Build.SERIAL; LOG.V ("Ola_log", "buildserial:" + buildserial);

Description: Unique values for hardware

Cons:API 9 is supported later, which is no longer a problem for general devices

5.UUID

String Uuid_value = Uuid.randomuuid (). toString (); LOG.V ("Ola_log", "Uuid_value:" + uuid_value);

Description: Randomuuid can randomly create a unique value, or use other built-in methods to create unique values

(Ex:nameuuidfrombytes (byte[] name)).

Disadvantage: the manufacture and storage of the UUID must be handled, if the use of Randomuuid represents the unique value of the installation

Android Unique values

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.