方法/步骤
在AndroidManifest.xml添加权限:
通过context对象获取TelephonyManager tManager类的实例
获取设备当前位置
String location = tManager.getCellLocation()==null? "未知地区":tManager.getCellLocation().toString();
获取手机制式
String simOperatorName = tManager.getSimOperatorName().equals("")?"未知":tManager.getSimOperatorName().toString();
获取SIM卡运营商名称
String networkOperatorName = tManager.getNetworkOperatorName()==null? "未知":tManager.getNetworkOperatorName().toString();
获取SIM卡号
String line1Number = tManager.getLine1Number()==null? "未知":tManager.getLine1Number().toString();
将代码放入activity中进行执行
运行结果