Android这样获取本机网络提供商呢?请看下面代码:

[java] view plain copy
  1. publicStringgetProvidersName()
  2. {
  3. Stringstr="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. elseif(this.IMSI.startsWith("46003"))
  15. str="中国电信";
  16. }
  17. catch(ExceptionlocalException)
  18. {
  19. localException.printStackTrace();
  20. }
  21. returnstr;
  22. }

注意申明:

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

更多相关文章

  1. 中国电信已加盟Android阵营

随机推荐

  1. Android——TabWidget
  2. Android ViewHolder 优化 ListView
  3. Android倒计时器——CountDownTimer
  4. Android 如何加载大图片
  5. 在Android线程中设置控件的值会报错
  6. Android TabLayout导航条属性的设置
  7. Android开发遇到的问题
  8. Android 检测键盘是否显示及隐藏键盘
  9. Android 调用第三方浏览器打开
  10. Android Studio 的 gradle 插件升级失败