TelephonyManager manager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
if (type == TelephonyManager.NETWORK_TYPE_CDMA // 电信cdma网
|| type == TelephonyManager.NETWORK_TYPE_1xRTT
|| type == TelephonyManager.NETWORK_TYPE_EVDO_0
|| type == TelephonyManager.NETWORK_TYPE_EVDO_A
|| type == TelephonyManager.NETWORK_TYPE_LTE ) {
CdmaCellLocation cdma = (CdmaCellLocation) manager.getCellLocation();
if (cdma == null)
{
return null;
}
int lac = cdma.getNetworkId();
int cid = cdma.getBaseStationId();
}
获取电信基站信息代码如上,2G,3G,都是好的,但切换到4G,程序就崩溃
请查看程序崩溃的日志。4G是LTE。
兄弟解决了吗?我也碰到了这个问题,电信3g,电信4g manager.getCellLocation(); 返回的是null,求解啊