Android Get device Unique ID

Source: Internet
Author: User
Tags unique id

Android developers need to know the unique device ID on their phone in certain situations. For example, you can track the installation of an application and generate a unique ID for the device that is used to copy protected DRM. The sample code snippet as a reference is provided at the end of this document.

Range

This article provides an introduction to how to read the IDs of various Android devices to use identification numbers. This article assumes that the user has installed Android and the tools necessary to develop the application. Also, this article assumes that users already know the basics of Android.

Brief Introduction

There are several types of device identification numbers already in the device that is carrying the Android operating system. All previous Android devices have telephony capabilities, so it's easy to find the only Imei,meid, or ESN, of each device's hardware. However, only WiFi-capable devices or music players do not have phone hardware, so there is no unique identification number for this type. This article explains how to read the identification number of different Android devices.

retrieving Android device IDs in various ways

The following are the different types of identification device IDs for Android devices.

· Unique number (Imei,meid,esn,imsi)

· MAC address

· Serial number

· android_id

Unique Number (Imei,meid,esn,imsi)

Note in the past, when Android devices were used as telephones, it was simpler to find a unique identification number: () to find the unique imei,meid,esn and IMSI numbers (depending on the network technology) of the phone's hardware.

Telephonymanager.getdeviceid

the definition of Imei,meid,esn,imsi is as follows:

IMEI (International Mobile Device Identification code) unique number used to identify the GSM,WCDMA mobile phone and a number of satellite phones (mobile device identification Code) Globally unique number for the identification of CDMA mobile radio equipment physical hardware, The purpose of Meid is to replace the ESN (electronic serial number) (Electronic serial number) unique number, which is used to identify the unique identification number associated with all GSM and UMTS network mobile users in CDMA handsets (International Mobile user identification Code) if you need to retrieve the ID of the device, use the following code in your project:

Meid

ESN

IMSI[Java]  View plain copy import android.telephony.telephonymanager;           import android.content.context;                                                                       String    imeistring = null;                                                                  string    imsistring = null;                                                                                                 {                                                                                                   TelephonyManager    telephonyManager;                                                                                                                                                          telephonyManager =                  ( TelephonyManager ) Getsystemservice ( Context.TELEPHONY_SERVICE );                                        /*            * getdeviceid ()  function returns the unique  device ID.          * for example,the imei  for GSM and the MEID or ESN for CDMA phones.          */                                                                             imeistring = telephonymanager.getdeviceid ();                    /*         *  Getsubscriberid ()  function Returns the unique subscriber ID,    

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.