Get IMEI code

Source: Internet
Author: User

Core code:

Imei = ((Telephonymanager) Getsystemservice (Telephony_service))
. Getdeviceid ();

1. Permission to join

In the Manifest.xml file, add <uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>

2, the code is as follows:

/**  *  *@authorDingran * created on 2010-4-29 pm 05:02:47 **/   PackageNet.sunniwell.app; Importandroid.app.Activity; ImportAndroid.os.Bundle; Importandroid.telephony.CellLocation; ImportAndroid.telephony.PhoneStateListener; ImportAndroid.telephony.TelephonyManager;  Public classTelmanagerextendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Telephonymanager TM= (Telephonymanager) This. Getsystemservice (Telephony_service); /** Phone Status: * 1.tm. Call_state_idle=0 No Activity * 2.tm. Call_state_ringing=1 Bell * 3.tm. call_state_offhook=2 pick -up machine*/tm.getcallstate ();//int       /** Phone Directions: **/tm.getcelllocation ();//celllocation       /** unique Device ID: * GSM phone's IMEI and CDMA phone's MEID.     * Return NULL if device ID is not available. */Tm.getdeviceid ();//String       /** The software version number of the device: * For example: The IMEI/SV (software version) for GSM phones.      * Return NULL if the software version is not available. */tm.getdevicesoftwareversion ();//String       /** Mobile phone Number: * GSM mobile phone MSISDN.      * Return NULL if it is unavailable. */Tm.getline1number ();//String       /** Nearby Phone information: * Type:list<neighboringcellinfo> * requires permission: Android. Manifest.permission#access_coarse_updates*/tm.getneighboringcellinfo ();//list<neighboringcellinfo>       /** Get the ISO Standard country code, which is the international long distance code.     * Note: Only if the user has been registered with the network.     * Results may not be reliable in CDMA networks. */Tm.getnetworkcountryiso ();//String       /** MCC+MNC (Mobile Country code + mobile Network Code) * Note: only if the user is already active on the network registration.     * Results may not be reliable in CDMA networks. */tm.getnetworkoperator ();//String       /** Name of current registered operator (currently registered user) in alphabetical order * Note: only if the user is registered with the network.     * Results may not be reliable in CDMA networks. */tm.getnetworkoperatorname ();//String       /** Currently used network type: * For example: Network_type_unknown network type unknown 0 network_type_gprs GPRS Network 1 network_type_e    DGE Edge Network 2 network_type_umts UMTS Network 3 NETWORK_TYPE_HSDPA HSDPA Network 8 Network_type_hsupa  HSUPA Network 9 Network_type_hspa HSPA Network, NETWORK_TYPE_CDMA CDMA Network, is95a or is95b.  4 network_type_evdo_0 EVDO Network, Revision 0.  5 network_type_evdo_a EVDO Network, revision A. 6 Network_type_1xrtt 1xRTT Network 7*/Tm.getnetworktype ();//int       /** Phone Type: * For example: Phone_type_none no signal phone_type_gsm GSM signal PHONE_TYPE_CDMA 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 providing a SIM card country code. *      */Tm.getsimcountryiso ();//String       /** Returns the MCC+MNC (mobile Country code + mobile Network Code) of the provider of the SIM. 5 or 6 decimal digi     Ts.     * Get the Mobile country Code and mobile network code provided by the SIM card. 5 or 6-bit decimal digits.     * The status of the SIM card must be Sim_state_ready (use Getsimstate () to determine). */tm.getsimoperator ();//String       /** Service Provider Name: * For example: China Mobile, Unicom * SIM card status must be Sim_state_ready (using Getsimstate ()). */tm.getsimoperatorname ();//String       /** Serial number of SIM card: * Requires permission: Read_phone_state*/Tm.getsimserialnumber ();//String       /** status information of SIM: * Sim_state_unknown Unknown status 0 sim_state_absent card 1 sim_state_pin_requi RED lock status, requires the user's PIN code to unlock 2 sim_state_puk_required lock state, requires the user's PUK code to unlock 3 sim_state_network_locked lock State, need the network PIN code Unlock 4 Sim_state_ready ready State 5*/tm.getsimstate ();//int       /** Unique User id: * For example: IMSI (International Mobile User identification Code) for a GSM phone. * Requires permission: Read_phone_state*/Tm.getsubscriberid ();//String       /** Get the label associated with the voice mail, that is, the identifier * requires permission: Read_phone_state*/Tm.getvoicemailalphatag ();//String       /** Get voice mail number: * Requires permission: Read_phone_state*/Tm.getvoicemailnumber ();//String       /** The ICC card is present*/Tm.hasicccard ();//Boolean       /** Whether to roam: * (under GSM use)*/tm.isnetworkroaming ();//                  }       } 

Transferred from: http://blog.csdn.net/gumanren/article/details/6209237

Get IMEI code

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.