Android about Android.os.Build Introduction

Source: Internet
Author: User

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

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.