Introduction to the Build class
This class is a class that acquires some initialization information for a device, and the primary information for that class is obtained through some static fields:
public static final String |
BOARD |
The name of the underlying board, like "goldfish". (Equipment Manufacturer) |
public static final String |
BOOTLOADER |
The system bootloader version number. |
public static final String |
BRAND |
The brand (e.g, carrier) the software is customized for, if any. |
public static final String |
Cpu_abi |
The name of the instruction set (CPU type + ABI convention) of native code. |
Import Android.content.Context;
Import Android.telephony.TelephonyManager;
/**
* Read the phone device information test code
* Http://www.souapp.com Search Application Network
* [Email protected]
* Song Lipo
*/
public class Phoneinfo {
Private Telephonymanager Telephonymanager;
/**
* International Mobile Subscriber Identification code
*/
Private String IMSI;
Private Context CXT;
Public Phoneinfo (Context context) {
Cxt=context;
Telephonymanager = (Telephonymanager) context
. Getsystemservice (Context.telephony_service);
}
/**
* Get Phone number
*/
Public String Getnativephonenumber () {
String Nativephonenumber=null;
Nativephonenumber=telephonymanager.getline1number ();
return nativephonenumber;
}
/**
* Get phone service Information
*/
public string Getprovidersname () {
String providersname = "N/a";
try{
IMSI = Telephonymanager.getsubscriberid ();
IMSI Front 3 bit 460 is the country, followed by 2 bit 00 02 is China Mobile, 01 is China Unicom, 03 is Chinese telecom.
System.out.println (IMSI);
if (Imsi.startswith ("46000") | | Imsi.startswith ("46002")) {
Providersname = "China Mobile";
} else if (Imsi.startswith ("46001")) {
Providersname = " China Unicom ";
} else if (Imsi.startswith ("46003")) {
Providersname = "China Telecom";
}
}catch (Exception e) {
E.printstacktrace ();
}
return providersname;
}
Public String getphoneinfo () {
Telephonymanager TM = (Telephonymanager) cxt.getsystemservice ( Context.telephony_service);
StringBuilder sb = new StringBuilder ();
Sb.append ("\ndeviceid (IMEI) =" + Tm.getdeviceid ());
Sb.append ("\ndevicesoftwareversion =" + tm.getdevicesoftwareversion ());
Sb.append ("\nline1number =" + Tm.getline1number ());
Sb.append ("\nnetworkcountryiso =" + Tm.getnetworkcountryiso ());
Sb.append ("\nnetworkoperator =" + Tm.getnetworkoperator ());
Sb.append ("\nnetworkoperatorname =" + Tm.getnetworkoperatorname ());
Sb.append ("\nnetworktype =" + Tm.getnetworktype ());
Sb.append ("\nphonetype =" + Tm.getphonetype ());
Sb.append ("\nsimcountryiso =" + Tm.getsimcountryiso ());
Sb.append ("\nsimoperator =" + Tm.getsimoperator ());
Sb.append ("\nsimoperatorname =" + Tm.getsimoperatorname ());
Sb.append ("\nsimserialnumber =" + Tm.getsimserialnumber ());
Sb.append ("\nsimstate =" + tm.getsimstate ());
Sb.append ("\nsubscriberid (IMSI) =" + Tm.getsubscriberid ());
Sb.append ("\nvoicemailnumber =" + Tm.getvoicemailnumber ());
return sb.tostring ();
}
}
Android about Android.os.Build Introduction