Android determines which carrier the SIM card is.

Source: Internet
Author: User
Package com. eboy. checksimoperator;

Import Android. App. activity;
Import Android. content. context;
Import Android. OS. Bundle;
Import Android. telephony. telephonymanager;
Import Android. View. Menu;
Import Android. View. view;
Import Android. widget. Toast;

Public class mainactivity extends activity {

@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. activity_main );

@ Override
Public Boolean oncreateoptionsmenu (menu ){
Getmenuinflater (). Inflate (R. Menu. activity_main, menu );
Return true;

Public void checksim (view v ){
Telephonymanager telmanager = (telephonymanager) getsystemservice (context. telephony_service );
String operator = telmanager. getsimoperator ();
If (Operator! = NULL ){
If (operator. Equals ("46000") | Operator. Equals ("46002 ")){
Toast. maketext (this, "this card belongs to (China Mobile)", Toast. length_short). Show ();
} Else if (operator. Equals ("46001 ")){
Toast. maketext (this, "this card belongs to (China Unicom)", Toast. length_short). Show ();
} Else if (operator. Equals ("46003 ")){
Toast. maketext (this, "this card belongs to (China Telecom)", Toast. length_short). Show ();

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: 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.