获取手机运营商名称

来源:互联网 发布:支付宝跟淘宝怎么解绑 编辑:程序博客网 时间:2024/04/30 16:35


[java] view plaincopy
  1. public String getProvidersName()  
  2.  {  
  3.    String str = "N/A";  
  4.    try  
  5.    {  
  6.      this.IMSI = this.telephonyManager.getSubscriberId();  
  7.      System.out.println(this.IMSI);  
  8.      if (this.IMSI.startsWith("46000"))  
  9.       str = "中国移动";  break;  
  10.      if (this.IMSI.startsWith("46002"))  
  11.       str = "中国移动"break ;  
  12.      if (this.IMSI.startsWith("46001"))  
  13.        str = "中国联通";  
  14.      else if (this.IMSI.startsWith("46003"))  
  15.        str = "中国电信";  
  16.    }  
  17.    catch (Exception localException)  
  18.    {  
  19.      localException.printStackTrace();  
  20.    }  
  21.         return str;  
  22.  }  

注意申明:

[java] view plaincopy
  1. this.telephonyManager = ((TelephonyManager)paramContext.getSystemService("phone"));  
0 0