Android operator and network type analysis

Source: Internet
Author: User

Some requirements require operators and network types to be analyzed below for operator and network types.

First throw some nonsense definition:

GSM: The global system of mobile communication is known as GSM and is the most widely used mobile phone standard in the world today.
CDMA: Code Division Multiple Access (CDMA) is a new and mature wireless communication technology developed in the branch of digital technology-spread spectrum communication technology.
It can be seen that the two are technical standards, regardless of network type and format.

Go to the chase.

1. Get Phone type

This can be obtained by means of Telephonymanager#getphonetype, and the following is the return type.

/**     * Returns A constant indicating the device phone type.  This     * indicates the type of radio used to transmit voice calls.     *     * @see #PHONE_TYPE_NONE     * @see #PHONE_TYPE_GSM     * @see #PHONE_TYPE_CDMA * @see #PHONE_TYPE_SIP     * *     
Commonly used phone type is GSM type and CDMA type, SIP is related to VoIP, usually not often encountered.


2. Get Carrier

Telephonymanager#getsimoperator is used to obtain the SIM card operator ID, such as mobile is 46002

Telephonymanager#getsimoperatorname method to get operator name, such as Mobile is CMCC

Telephonymanager#getsimcountryiso get SIM card countries such as China is CN

Telephonymanager#getsimstate getting SIM card status


3. Get the network type

The point has come.

The Telephonymanager#getnetworktype method gets the network type.

This is what is needed to clearly show the current network of the phone, such as "Unicom 3G".

Found some code on the Internet, see some code behind some network types marked: "Mobile 2G", I just want to say "hehe".

The reason is that it is not possible to judge this from a single network type.

Back to the chase, start analyzing the return value.


1) Network_type_gprs

GPRS is a standard, equivalent to 2.5G, it is independent of the phone type and exist, although mobile is GSM phone, Unicom is a CDMA phone, but they can have this format,

Take the mobile 2G example, my city is the Edge network. But before, mobile and Unicom may have simultaneous use of GPRS,

It also does not rule out the possibility that some areas of the mobile still deploy GPRS, so it is more unfavorable to label the predecessor "Mobile 2G" behind the code.


2) Network_type_edge

Edge should be considered 2.75G. As far as I know, Unicom does not seem to have upgraded the 2G network to this format. And the move is currently in use with this.


3) Network_type_umts

UMTS definition is a 3G mobile phone technology, using WCDMA as the underlying standard, WCDMA backwards compatible with GSM network.

At present, China is only unicom, and this is really the only way to judge the operators and their network types.


4) NETWORK_TYPE_CDMA

The definition of CDMA is a technical standard with its 2-generation, 2.5-generation, 3-generation technology. is considered to be the first choice for 3 generations of mobile technology, including the standard

WCDMA, CDMA2000, TD-SCDMA. Here CDMA refers to the CDMA2 generation of technical standards, China Telecom in use.


5) Network_type_1xrtt

In CDMA2000, which is usually considered to be 2.5G or 2.75G, the rate is only a fraction of the other 3G, which telecommunications may use.


6) Network_type_evdo_0, Network_type_evdo_a, Network_type_evdo_b

Both are versions of the CDMA2000 standard, which belong to 3G, which telecom may use.


7) NETWORK_TYPE_HSDPA

A communication protocol, based on WCDMA, equivalent to 3.5G, Unicom may use.


8) Network_type_lte

The corresponding 4G can be used by each operator.


9) network_type_gsm

This value is hidden, the value is 16, and you don't know what card will appear. Conjecture should be the earliest format for the GSM standard, not verified.


) NETWORK_TYPE_TD_SCDMA

is also hidden, with a value of 17, which is the value used when moving 3G.


Conclusion: Judging which carrier that network should not be judged only by Networktype.

Operators are available separately, while Networktype can further know whether it is 2G or 3G.

Other Chinese non-existent formats will not be judged first.


4. For Android version compatibility

For devices with low Android versions, some types of definitions are not included, so it's a good idea to redefine these network type variables in your own class


Android operator and network type analysis

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.