我正在制作一个应用程序,其中我必须获得乳胶和细胞id。我正在使用
private PhoneStateIntentReceiver mPhoneStateReceiver;
ServiceState state = mPhoneStateReceiver.getServiceState();
int cid = state.getCid();
int lac = state.getLac();它给出的错误是PhoneStateIntentReceiver不能解析为类型,而getcellid和getlac也给出错误,即ServiceState没有定义getcellid
任何帮助都将不胜感激。
发布于 2011-12-22 17:42:43
使用它来获取cid和Lac
final TelephonyManager telephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (telephony.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
final GsmCellLocation location = (GsmCellLocation) telephony.getCellLocation();
if (location != null) {
msg.setText("LAC: " + location.getLac() + " CID: " + location.getCid());
}
}有权限的
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>https://stackoverflow.com/questions/8601901
复制相似问题