Android 判斷SIM卡屬于哪個移動運營商
Android這樣獲取本機網絡提供商呢?請看下面代碼:
public String getProvidersName() { String str = "N/A"; try { this.IMSI = this.telephonyManager.getSubscriberId(); System.out.println(this.IMSI); if (this.IMSI.startsWith("46000")) str = "中國移動"; break; if (this.IMSI.startsWith("46002")) str = "中國移動"; break ; if (this.IMSI.startsWith("46001")) str = "中國聯通"; else if (this.IMSI.startsWith("46003")) str = "中國電信"; } catch (Exception localException) { localException.printStackTrace(); } return str; }注意申明:
this.telephonyManager = ((TelephonyManager)paramContext.getSystemService("phone"));
本文由用戶 zt80 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!