Android Read MCC, MNC

Source: Internet
Author: User

Telephonymanager Telmanager = (telephonymanager) getsystemservice (Context.telephony_service);
/**Get the IMSI code of the SIM card
* SIM card Unique identification: IMSI International Mobile User identification number (imsi:international Mobile subscriber identification number) is a sign that distinguishes mobile users,
* Stored in SIM card, can be used to distinguish the effective information of mobile users. IMSI is comprised of MCC, MNC, Msin, which is the mobile country number, consisting of 3 digits,
* Uniquely identify the country that the mobile customer belongs to, our country is the network ID of 460;MNC, consisting of 2 digits,
* Used to identify mobile customers belonging to the mobile network, China Mobile is 00, the Chinese unicom is 01, the Telecom for 03;msin Mobile Customer Identification Code, the use of equal length 11 digits.
* Uniquely identify domestic GSM mobile communication network to move customers. So to distinguish between mobile or unicom, just get the MNC field in the SIM card
*/
String IMSI = Telmanager.getsubscriberid ();
if (imsi!=null) {
if (Imsi.startswith ("46000") | | | imsi.startswith ("46002")) {//Because the mobile network number 46000 under the IMSI has run out, so virtual a 46002 number, 134/ This number is used in section 159th
Mobile
}else if (Imsi.startswith ("46001")) {
China Unicom
}else if (Imsi.startswith ("46003")) {
Telecom
}
}

IMSI: International Mobile Subscriber Identification number (unique identifier), IMSI = MCC + MNC + msin, where MCC refers to the mobile station country code (3-bit, China 460), MNC refers to the mobile network Code (2 Chinese), Msin refers to mobile user identification numbers (10-bit)

IMSI a total of 15 bits, the structure is as follows:

Mcc+mnc+msin, (Mnc+msin=nmsi)

Mcc:mobile Country Code, mobile Country Code, MCC resources by the ITU (ITU) unified distribution and management, the only identification of mobile users belong to the country, a total of 3, China is 460;

Mnc:mobile Network Code, mobile code, a total of 2, China Mobile TD system use 00, the Chinese Unicom GSM system use 01, Mobile GSM system use 02, China Telecom CDMA system using 03, A typical IMSI number is 460030912121001;

The Msin:mobile Subscriber identification number has 10 bits, which are structured as follows:

09+m0m1m2m3+abcd

There is a correspondence between the M0M1M2M3 and the h0h1h2h3 in the MDN number, and the ABCD four bits are allocated freely.

You can see IMSI in the Msin number before the MCC is Nmsi, can distinguish each user from the country, so can achieve international roaming. In the same country, if there are multiple mobile network operators, the MNC can be used to differentiate.

Android Read MCC, MNC

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.