Android Network Status

Source: Internet
Author: User

Telephonymanager is a telephone function-related class in Android, which defines many constants.

To obtain the following information, you must specify the permission in androidmanifest. xml.

I. Data Connection status

Get data connection status: int getdatastate ()

Get data Activity Status: int getdataactivity ()

These are commonly used:

Int data_activity_in data connection status: active, receiving data

Int data_activity_out data connection status: active, sending data

Int data_activity_inout data connection status: active, receiving and sending data

Int data_activity_none data connection status: active, but no data is sent or accepted

Int data_connected data connection status: connected

Int data_connecting data connection status: In Connection

Int data_disconnected data connection status: disconnected

Int data_susponded data connection status: paused

Ii. Mobile Network Type

Obtain the network type: int getnetworktype ()

These are commonly used:

The Int network_type_cdma network type is CDMA.

Int network_type_edge: The network type is edge.

Int network_type_evdo_0 network type is evdo0

Int network_type_evdo_a: The network type is evdoa.

Int network_type_gprs: The network type is GPRS.

Int network_type_hsdpa: The network type is HSDPA.

Int network_type_hspa network type is HSPA

Int network_type_hsupa network type is hsupa

The network type of int network_type_umts is UMTS.

In China, China Unicom's 3G is UMTS or HSDPA, China Mobile and China Unicom's 2G is GPRS or egde, China Telecom's 2G is CDMA, and China Telecom's 3G is evdo

3. Mobile Phone standard type

Get Mobile Phone System: int getphonetype ()

Int phone_type_cdma mobile phone system: CDMA, Telecom

Int phone_type_gsm mobile phone system is GSM, mobile and Unicom

Int phone_type_none mobile phone system unknown

Iv. SIM card status

Get SIM card status: int getsimstate ()

Int sim_state_absent SIM card not found

The network of the int sim_state_network_locked SIM card is locked and must be unlocked by the Network pin.

Int sim_state_pin_required SIM card pin is locked and must be unlocked by user pin

Int sim_state_puk_required SIM card Puk is locked, user Puk is needed to unlock

Int sim_state_ready SIM card available

Int sim_state_unknown SIM card unknown

V. Other information

String getsimcountryiso ()

Returns the country code of the SIM card provider.

String getnetworkcountryiso ()

Return the ISO Standard Country Code, that is, the international long-distance area code.

String getsimoperator ()

String getnetworkoperator ()

Return MCC + MNC code (SIM card carrier country code and carrier network code) (imsi)

String getsimoperatorname ()

String getnetworkoperatorname ()

Returns the name of the mobile network operator (SPNs)

String getsubscriberid ()

Returns imsi, an international mobile user identification code.

String getdeviceid ()

If it is a GSM network, IMEI is returned; if it is a CDMA network, meId is returned.

String getsimserialnumber ()

Returns the serial number (IMEI) of the SIM card)

String getline1number ()

Return the mobile phone number, which is msisdn for the GSM network.

Boolean isnetworkroaming ()

Whether the mobile phone is roaming

Explanation:

Imsi (short for International Mobile Subscriber Identity)

Imsi has a total of 15 digits, and its structure is as follows:

MCC + MNC + min

MCC: Mobile country code, mobile country code, 3 digits in total, 460 for China;

MNC: Mobile networkcode, mobile network code, two digits in total

In China, the mobile code is e 00 and 02, China Unicom code is 01, and China Telecom code is 03

In combination, this is (also the code in the APN configuration file of the Android phone ):

China Mobile: 46000 46002

China Unicom 46001

China Telecom 46003

For example, a typical imsi number is 460030912121001.

IMEI is short for International Mobile Equipment Identity (international mobile device identification)

IMEI is an electronic serial number consisting of 15 digits. It corresponds to each mobile phone one by one and is the only one in the world.

It consists:

1. The first 6 digits (TAC) are "model approval numbers", which generally represent models

2. The next two digits (FAC) are the "last Assembly number", which generally represents the origin

3. the next 6 digits (SNR) are "serial numbers", which generally represent the production sequence numbers.

4. the last 1-digit (SP) is usually "0", which is the Verification Code and is currently in use.

Related Article

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.