Detailed description of IMEI (international mobile device ID code) number obtained by Android and its application scenarios

Source: Internet
Author: User

IMEI introduction:

IMEI (International Mobile Equipment Identity) is the abbreviation of international mobile device identity code. It is an "electronic serial number" consisting of 15 digits ", it corresponds to each mobile phone, and the code is the only one in the world. Each mobile phone is assigned a unique group of numbers in the world after it is assembled. This number will be recorded by the manufacturer who manufactures it from production to delivery.

IMEI, also known as the "Serial Number", is stored in the phone's EEPROM (also known as the "Serial Number"). Being familiar with and aware of this number will play a very important role in our identification of mobile phones in the future. First, the top three TAC codes (the first six digits of IMEI) will change in different periods, and the last three TAC codes will not appear on current mobile phones. In the past, some old mobile phones started with 446/448, for example, Moto v328 Nokia 7110, and even a mobile phone may have different TAC codes in different periods, if you are familiar with upgrading 8210. If the first three digits are 448902, they cannot be upgraded because the CPU is different. Therefore, it is not accurate to say that the TAC code of a mobile phone of the same model is the same. For example, t39mc of a mobile phone of the same model of Ericsson may have different numbers in different regions: the number of goods in mainland China is 520406, while that in Hong Kong is 520407. Once we know the differences, we can use the TAC code to identify devices. Instead, we don't have to worry about the seven or eight-digit IMEI characters.

IMEI allocation:

IMEI codes are centrally allocated by the GSM (Global Mobile Communications Association) and authorized to be reviewed by babt (UK communications Certification Board ).

IMEI composition:


IMEI consists of 15 digits, which are 1. The first six digits (TAC, type approvalCode) Is the "model approval number", which generally represents the Model

2. The next two digits (FAC, final assembly COdeIs the "last Assembly number", generally representing the origin

3. the next 6 digits (SNR) are "serial numbers", which generally represent the production sequence numbers.

4. the last 1-digit (SP) is usually "0", which is the Verification Code and is currently in use.

The IMEI code is unique and attached to the logo on the back of the mobile phone. It is read and written to the memory of the mobile phone. It is also the "file" and "ID card number" of the mobile phone in the manufacturer ".

Application scenarios:

When the application needs to encrypt the information submitted by the user, because the IMEI number of the mobile phone is unique (equivalent to the ID card or fingerprint ), therefore, we can add the IMEI number of the mobile phone number after the encrypted information to increase the complexity of the algorithm.


Android gets the IMEI number

Core code:

IMEI = (telephonymanager) getsystemservice (telephony_service ))
. Getdeviceid ();

1. Add Permissions

Add the following content to the manifest. xml file:

<Uses-Permission Android: Name = "android. Permission. read_phone_state"/>

2. Code

/*****/Package net. sunniwell. APP; import android. app. activity; import android. OS. bundle; import android. telephony. celllocation; import android. telephony. phonestatelistener; import android. telephony. telephonymanager; public class telmanager extends activity {@ override protected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); telephonymanager TM = (telephonymanag Er) This. getsystemservice (telephony_service);/** call status: * 1. TM. call_state_idle = 0 no activity * 2. TM. call_state_ringing = 1 bell * 3. TM. call_state_offhook = 2 disconnect */TM. getcallstate (); // int/** phone location: **/TM. getcelllocation (); // celllocation/** unique device ID: * IMEI of the GSM mobile phone and meid of the CDMA mobile phone. * return NULL if device ID is not available. */TM. getdeviceid (); // string/** software version number of the device: * For example, the IMEI/SV (Software Version) for G SM phones. * return NULL if the software version is not available. */TM. getdevicesoftwareversion (); // string/** mobile phone number: * msisdn of the GSM mobile phone. * return NULL if it is unavailable. */TM. getline1number (); // string/** nearby phone information: * type: List <neighboringcellinfo> * permission required: Android. manifest. permission # access_coarse_updates */TM. getneighboringcellinfo (); // list <neighboringcellinfo>/** gets the ISO Standard Country Code, that is, the international long distance area code. * Note: it is valid only after the user has registered the network. * The results may be unreliable in CDMA networks. */TM. getnetworkcountryiso (); // string/** MCC + MNC (mobile country code + mobile network code) * Note: it is valid only when the user has registered the network. * The results may be unreliable in CDMA networks. */TM. getnetworkoperator (); // string/** name of the current registered operator (currently registered user) in alphabetical order * Note: this parameter is valid only when the user is registered on the network. * The results may be unreliable in CDMA networks. */TM. getnetworkoperatorname (); // string/** current network type used: * example: unknown network type 0 network_type_gprs GPRS network 1 network_type_edge Network 2 network_type_umts UMTS network 3 hybrid HSDPA network 8 hybrid hsupa network 9 network_type_hspa HSPA network 10 network_type_cdma network, is95a or is95b. 4 network_type_evdo_0 evdo network, Revision 0. 5 network_type_evdo_a evdo network, Revision. 6 network_type_1x RTT 1xrtt network 7 */TM. getnetworktype (); // int/** mobile phone type: * e. g.: phone_type_none no signal phone_type_gsm GSM signal phone_type_cdma signal */TM. getphonetype (); // int/** returns the ISO country code equivalent for the sim provider's country code. * obtain the ISO country code, which is equivalent to the Country Code that provides the SIM card. **/TM. getsimcountryiso (); // string/** returns the MCC + MNC (mobile country code + mobile network code) of the provider of the sim. 5 or 6 decimal digits. * obtain the mobile country code and mobile network code provided by the SIM card. 5 or 6 digits in decimal format. * The SIM card status must be sim_state_ready (determined by getsimstate ). */TM. getsimoperator (); // string/** service provider name: * For example, China Mobile and China Unicom * the SIM card status must be sim_state_ready (determined by getsimstate ). */TM. getsimoperatorname (); // string/** SIM card serial number: * required permission: read_phone_state */TM. getsimserialnumber (); // string/** SIM status information: * sim_state_unknown unknown status 0 sim_state_absent no plug-in card 1 sim_state_pin_required lock status. the user's pin code is required to unlock 2 Tib lock status, the user's pukcode is required to unlock the 3 sim_state_network_locked lock status, and the network's pin code is required to unlock 4 sim_state_ready ready status 5 */TM. getsimstate (); // int/** Unique User ID: * For example, imsi (International Mobile User Identification Code) for a gsm phone. * permission required: read_phone_state */TM. getsubscriberid (); // string/** get the tags related to the voice mail, that is, the identifier * requires the permission: read_phone_state */TM. getvoicemailalphatag (); // string/** get the voice mail number: * permission required: read_phone_state */TM. getvoicemailnumber (); // string/** check whether the card exists */TM.  (); // Boolean/** roaming: * (for GSM purposes) */TM. isnetworkroaming ();//}}



Related Article

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.