【发布时间】:2014-01-13 22:36:45
【问题描述】:
我得到了错误的 3G 网络小区 ID,我得到了正确的 2G 小区 ID 值, 我不明白我哪里错了。请帮忙
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation cellLocation = (GsmCellLocation) telephonyManager
.getCellLocation();
//Cell Id, LAC
int cid = cellLocation.getCid();
int lac = cellLocation.getLac();
//MCC
String MCC =telephonyManager.getNetworkOperator();
int mcc = Integer.parseInt(MCC.substring(0, 3));
String mcc1 = String.valueOf(mcc);
//Operator name
String operatoprName = telephonyManager.getNetworkOperatorName();
我还授予了AndroiManifest.xml文件ACCESS_COARSE_LOCATION、ACCESS_NETWORK_STATE
【问题讨论】:
-
请回答。