html5中文学习网

您的位置: 首页 > android » 正文

Android 判断SIM卡属于哪个移动运营商的实现代码_Android_脚本之家

[ ] 已经帮助:人解决问题

复制代码 代码如下:

[java]
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;
  }

注意申明:
[java]
复制代码 代码如下:

this.telephonyManager = ((TelephonyManager)paramContext.getSystemService("phone"));

就这么简单。。。。

(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助