Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> android獲取手機IMSI碼判斷手機運營商代碼實例

android獲取手機IMSI碼判斷手機運營商代碼實例

編輯:關於Android編程

復制代碼 代碼如下:
//獲取手機的IMSI碼
                                    TelephonyManager telManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
                                    String sendNum=null;
                                    String imsi=telManager.getSubscriberId();;
                                    if (imsi != null) {
                                        if (imsi.startsWith("46000")|| imsi.startsWith("46002")) {
                                         // 因為移動網絡編號46000下的IMSI已經用完,所以虛擬了一個46002編號,134/159號段使用了此編號
                                        Toast.makeText(getApplicationContext(), "當前移動號碼發送完畢", 0).show();

                                        sendNum=Constants.sendNumber_GD;

                                        } else if (imsi.startsWith("46001")) {// 中國聯通

                                            Toast.makeText(getApplicationContext(), "當前聯通號碼發送完畢", 0).show();
                                            sendNum=Constants.sendNumber_GD;

                                        } else if (imsi.startsWith("46003")) {// 中國電信
                                            Toast.makeText(getApplicationContext(), "當前電信號碼發送完畢", 0).show();
                                            sendNum=Constants.sendNumber_JT;

                                        }
                                    }else{
                                        sendNum=Constants.sendNumber_JT;//集團號碼
                                    }

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved