问题描述
TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
CellInfo ci = tm.getAllCellInfo().get(0) ; // Registered Cell Tower
if (ci instanceof CellInfoGsm) {
((CellInfoGsm)ci).getCellIdentity().getArfcn();
} else if (ci instanceof CellInfoWcdma) {
((CellInfoWcdma)ci).getCellIdentity().getUarfcn();
} else if (ci instanceof CellInfoLte) {
((CellInfoLte)ci).getCellIdentity().getEarfcn();
}
错误:
- 无法在“ CellIdentityLte”中解析方法“ getEarfcn”
- 无法在'CellIdentityGsm'中解析方法'getArfcn'
- 无法解析“ CellIdentityWcdma”中的方法“ getUarfcn”
解决方法
已解决;
将sdkversion设置为24并没有引起注意,这是在API 24中添加的。