Sometimes we want to obtain information about the machine, such as sim card information and mobile phone developer information. At this time, we can use telephonymanager. Let's take a look at a detailed introduction to the code found on the Internet.
Import android. app. activity; <br/> Import android. OS. bundle; <br/> Import android. telephony. celllocation; <br/> Import android. telephony. phonestatelistener; <br/> Import android. telephony. telephonymanager; <br/> public class telmanager extends activity {</P> <p> @ override <br/> protected void oncreate (bundle savedinstancestate) {<br/> super. oncreate (savedinstancestate); <br/> telephonymanager TM = (teleph Onymanager) This. getsystemservice (telephony_service); </P> <p>/* <br/> * phone status: <br/> * 1. TM. call_state_idle = 0 no activity <br/> * 2. TM. call_state_ringing = 1 <br/> * 3. TM. call_state_offhook = 2 delimiters <br/> */<br/> TM. getcallstate (); // int </P> <p>/* <br/> * phone location: <br/> */<br/> TM. getcelllocation (); // celllocation </P> <p>/* <br/> * unique device ID: <br/> * IMEI of the GSM mobile phone and meid of the CDMA mobile phone. <br/> * return NULL if Devic E id is not available. <br/> */<br/> TM. getdeviceid (); // string </P> <p>/* <br/> * Software Version: <br/> * example: the IMEI/SV (Software Version) for GSM phones. <br/> * return NULL if the software version is not available. <br/> */<br/> TM. getdevicesoftwareversion (); // string </P> <p>/* <br/> * mobile phone number: <br/> * msisdn of the GSM mobile phone. <br/> * return NULL if it is unavailable. <br/> */<br/> TM. getline1number (); // string </P> <P>/* <br/> * nearby phone information: <br/> * type: List <neighboringcellinfo> <br/> * permission required: Android. manifest. permission # access_coarse_updates <br/> */<br/> TM. getneighboringcellinfo (); // list <neighboringcellinfo> </P> <p>/* <br/> * obtain the ISO Standard Country Code, that is, the international long distance area code. <Br/> * Note: it is valid only after the user has registered with the Internet. <Br/> * the result may be unreliable in the CDMA network. <Br/> */<br/> TM. getnetworkcountryiso (); // string </P> <p>/* <br/> * MCC + MNC (mobile country code + mobile network code) <br/> * Note: valid only when the user is registered on the network. <Br/> * the result may be unreliable in the CDMA network. <Br/> */<br/> TM. getnetworkoperator (); // string </P> <p>/* <br/> * Current registered operator in alphabetical order (currently registered user) <br/> * Note: this parameter is valid only when the user is registered on the Internet. <Br/> * the result may be unreliable in the CDMA network. <Br/> */<br/> TM. getnetworkoperatorname (); // string </P> <p>/* <br/> * current network type: <br/> * example: network_type_unknown Unknown network type 0 <br/> network_type_gprs GPRS network 1 <br/> network_type_edge EDGE network 2 <br/> network_type_umts UMTS network 3 <br/> network_type_hsdpa HSDPA network 8 <br/> network_type_hsupa hsupa network 9 <br/> network_type_hspa HSPA network 10 <br/> network_type_cdma network, is95a or is95b. 4 <br/> network_type_evdo_0 Evdo network, Revision 0. 5 <br/> network_type_evdo_a evdo network, Revision. 6 <br/> network_type_1xrtt 1xrtt network 7 <br/> */<br/> TM. getnetworktype (); // int </P> <p>/* <br/> * Mobile Phone type: <br/> * example: phone_type_none no signal <br/> phone_type_gsm GSM signal <br/> phone_type_cdma signal <br/> */<br/> TM. getphonetype (); // int </P> <p>/* <br/> * returns the ISO country code equivalent for the sim provider's country code. <br/> * Gets the ISO country code, which is equivalent to the Country Code that provides the SIM card. <Br/> */<br/> TM. getsimcountryiso (); // string </P> <p>/* <br/> * returns the MCC + MNC (mobile country code + mobile network code) of the provider of the sim. 5 or 6 decimal digits. <br/> * obtain the mobile country code and mobile network code provided by the SIM card. 5 or 6 digits in decimal format. <br/> * the SIM card status must be sim_state_ready (determined by getsimstate ). <br/> */<br/> TM. getsimoperator (); // string </P> <p>/* <br/> * service provider name: <br/> * example: china Mobile and China Unicom <br/> * the SIM card status must be sim_state_ready (determined by getsimstate ). <br/> */<br/> TM. getsimoperatorname (); // string </P> <p>/* <br/> * Sim card serial number: <br/> * required permissions: read_phone_state <br/> */<br/> TM. getsimserialnumber (); // string </P> <p>/* <br/> * Sim status information: <br/> * sim_state_unknown unknown status 0 <br/> sim_state_absent no plug-in 1 <br/> sim_state_pin_required locked status, requiring the user's pin code to unlock 2 <br/> sim_state_puk_required lock, you need to unlock the user's pukcode 3 <br/> sim_state_network_locked lock status, the Network pin is required to unlock 4 <br/> sim_state_ready ready status 5 <br/> */<br/> TM. getsimstate (); // int </P> <p>/* <br/> * Unique User ID: <br/> * example: imsi (International Mobile User identification code) for a gsm phone. <br/> * required permission: read_phone_state <br/> */<br/> TM. getsubscriberid (); // string </P> <p>/* <br/> * obtain the tags related to the voice mail, that is, the identifier <br/> * requires the permission: read_phone_state <br/> */<br/> TM. getvoicemailalphatag (); // string </P> <p>/* <br/> * obtain the voice mail number: <br/> * permission required: read_phone_state <br/> */<br/> TM. getvoicemailnumber (); // string </P> <p>/* <br/> * check whether the ICC card exists <br/> */<br/> TM. hasicccard (); // Boolean </P> <p>/* <br/> * roaming: <br/> * (for GSM purposes) <br/> */<br/> TM. isnetworkroaming (); // </P> <p >}</P> <p>}
The SIM card information is as follows: