对于使用BTS跟踪设备,我需要CID和Lac。在诸如Asus和Huawei之类的设备中,当location(gps)关闭时,无法跟踪所有这些方法并返回null。
/** Current Location Area Code */
int mCurLAC = 0;
/** Current Location Cell ID */
int mCurCID = 0;
TelephonyManager mTelephonyManager = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation gsmCellLocation = (GsmCellLocation) mTelephonyManager.getCellLocation();
CellLocation cellLocation = mTelephonyManager.getCellLocation();
List<NeighboringCellInfo> mNeighboringCellInfo = mTelephonyManager.getNeighboringCellInfo();
List<CellInfo> allCellInfo = mTelephonyManager.getAllCellInfo();
mCurCID = gsmCellLocation.getCid();
mCurLAC = gsmCellLocation.getLac();
gsmCellLocation
返回null
mNeighboringCellInfo
返回null
allCellInfo
返回null
cellLocation
返回null
关闭GPS后如何获取当前位置?