Android Judgment SIM card is the _android of China Mobile \ Chinese Unicom telecom (mobile operator)

Source: Internet
Author: User
Tags unique id

The first method:

Get the IMSI code of the mobile phone, and judge that China Mobile \ Chinese Unicom Telecom

Telephonymanager Telmanager = (telephonymanager) getsystemservice (context.telephony_service);
/** gets the SIM card's IMSI code
* SIM card Unique ID: IMSI International Mobile User identification Code (imsi:international Mobile Subscriber identification number) is a sign that distinguishes mobile users,
* stored in a SIM card that can be used to differentiate valid information from mobile users. IMSI is composed of MCC, MNC, Msin, of which MCC is the mobile country number, composed of 3 digits,
* Uniquely identify the country to which the mobile customer belongs, and our country is 460;MNC as the network ID, consisting of 2 digits,
* To identify the mobile network to which the mobile customer belongs, China Mobile is 00, Unicom is 01, Chinese Telecom is 03;msin for mobile customer identification code, with equal length of 11 digits composition.
* Uniquely identify the domestic GSM mobile communication network to move customers. So to distinguish between moving or unicom, just get the MNC field in the SIM card can be
*
/String IMSI = Telmanager.getsubscriberid ();
if (imsi!=null) {
if (Imsi.startswith ("46000") | | imsi.startswith ("46002")) {//Because the IMSI under mobile network number 46000 has been exhausted, So virtual a 46002 number, 134/159th segment using this number
//China Mobile
}else if (Imsi.startswith ("46001")) {//
China Unicom
}else if ( Imsi.startswith ("46003")) {
//China Telecom
}

The second method

Telephonymanager Telmanager = (telephonymanager) getsystemservice (context.telephony_service);
String operator = Telmanager.getsimoperator ();
if (operator!=null) {
if (operator.equals ("46000") | | operator.equals ("46002")) {
//China Mobile
}else if ( Operator.equals ("46001")) {//
unicom
}else if (operator.equals ("46003")) {
//China Telecom
}
}

The above is a small set up to introduce the Android Judgment SIM card is China Mobile Unicom Chinese Telecom (mobile operators), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.