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(安卓)获取基站信息
  2. android通过代码来开启和关闭移动网络
  3. 中国电信已加盟Android阵营
  4. Google放弃“不做恶”? 意欲垄断Android
  5. 中国移动互联网:清一色的NOKIA!
  6. Android下编写HelloWorld
  7. 获取andrid apn信息
  8. Android获取运营商信息
  9. Android通过代码打开和关闭网络连接

随机推荐

  1. 安卓模拟器 运行出错(cannot launch AVD
  2. Android初级教程短信防火墙
  3. Android(安卓)代码分析 私有析构函数
  4. Android Activity和Intent机制学习笔记
  5. [转]Android对Handler和ViewRoot的理解
  6. Android软键盘与输入框的设置
  7. Android:Path总结
  8. android开机自动运行程序
  9. 一个编译时注解的 RxBus 库 - Apollo
  10. Android自定义相机开发相关知识点(全)