Android 判断SIM卡属于哪个移动运营商

2015-04-23 0 328
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"));  

遇见资源网 java Android 判断SIM卡属于哪个移动运营商 http://www.ox520.com/9229.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务