首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Android6.x中如何获取getNetworkOperatorName()

在Android6.x中如何获取getNetworkOperatorName()
EN

Stack Overflow用户
提问于 2016-12-07 13:27:57
回答 1查看 1.5K关注 0票数 0
代码语言:javascript
复制
TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);

if(tm != null)
    carrier = tm.getNetworkOperatorName();

我只想知道网络运营商的名字,叫“运营商”。但始终在android 6设备上返回"“。有什么解决方案吗?

EN

回答 1

Stack Overflow用户

发布于 2016-12-07 13:35:05

代码语言:javascript
复制
//Here is snippet, hope it helps you!
TelephonyManager tManager = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);

// Get carrier name (Network Operator Name) 
String carrierName = tManager.getNetworkOperatorName();
String operatorName = tManager.getSimOperatorName(); //try this

// Get Phone model and manufacturer name 
String manufacturer = Build.MANUFACTURER;
String model = Build.MODEL;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41010041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档