android gets the mobile phone IMSI code to judge the mobile phone carrier code instance

  • 2020-05-19 05:51:16
  • OfStack


// Get the phone's IMSI code 
                                    TelephonyManager telManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
                                    String sendNum=null;
                                    String imsi=telManager.getSubscriberId();;
                                    if (imsi != null) {
                                        if (imsi.startsWith("46000")|| imsi.startsWith("46002")) {
                                         //  Because of the mobile network number 46000 Under the IMSI I've run out, so it's virtual 1 a 46002 Number, 134/159 This number is used in the number segment  
                                        Toast.makeText(getApplicationContext(), " The current mobile number has been sent ", 0).show();

                                        sendNum=Constants.sendNumber_GD;

                                        } else if (imsi.startsWith("46001")) {//  China Unicom  

                                            Toast.makeText(getApplicationContext(), " Current unicom number has been sent ", 0).show();
                                            sendNum=Constants.sendNumber_GD;

                                        } else if (imsi.startsWith("46003")) {//  China Telecom 
                                            Toast.makeText(getApplicationContext(), " The current telecom number has been sent ", 0).show();
                                            sendNum=Constants.sendNumber_JT;

                                        }
                                    }else{
                                        sendNum=Constants.sendNumber_JT;// Group number 
                                    }


Related articles: