Http://marshal.easymorse.com/archives/1532
If you need to obtain mobile phone information through the android SDK. You can obtain this information as follows:
Telephonymanager=(Telephonymanager)This. Getsystemservice (context. telephony_service); string IMEI=Telephonymanager. getdeviceid ();
However, when writing this code, an error similar to how to view Android exceptions is reported, mainly because Android permissions need to be opened and added to the androidmanifest. xml file:
<Uses-PermissionAndroid: Name= "Android. Permission. read_phone_state" />
You can get the IMEI number of your mobile phone.
Telephonymanager can call other methods to obtain other information about the mobile phone.
For exampleGet mobile phone number, You can do this:
Telephonymanager. getline1number ();
However, in the G1 mobile phone test, the mobile phone number cannot be obtained by using the mobile global SIM card, which is an empty string.
Get the SIM card number of your mobile phone:
Telephonymanager. getsimserialnumber ();
This can be obtained in the above environment.
Get customer IDIn GSM, It is the imsi Number:
Telephonymanager. getsubscriberid ();
This can also be obtained in the merchant environment.
For more information about telephonymanager APIs, see:
Http://developer.android.com/intl/zh-CN/reference/android/telephony/TelephonyManager.html