2
현재 셀 위치 정보에 액세스하려고합니다. getCellLocation()
으로 전화하면 null
을 반환합니다.getCellLocation이 null을 반환합니다.
동일한 코드가 1.5에서는 작동하지만 1.6 또는 2.1에서는 이 실패합니다. (1.6 및 HTC 범례 2.1이있는 G1에서 테스트 됨)
누군가가이 버그를 해결하는 데 도움을 줄 수 있습니까? 내 코드는 아래와 같습니다.
TelephonyManager tMgr = (TelephonyManager)
getSystemService(TELEPHONY_SERVICE);
outputView = (TextView) findViewById(R.id.output);
outputView.append("Device type:" + tMgr.getPhoneType() + "\n");
GsmCellLocation gsmCellLocation = (GsmCellLocation) tMgr.getCellLocation();
if (gsmCellLocation != null) {
String mCellId = "" + gsmCellLocation.getCid();
String mLAC = "" + gsmCellLocation.getLac();
Log.d("SDKService", "Cell Id: " + mCellId + " LAC: " + mLAC);
outputView.append("Cell Id: " + mCellId + " LAC: " + mLAC + "\n");
}
또한, 내가 추가 한 다음 사용 권한
ACCESS_FINE_LOCATION
ACCESS_COARSE_LOCATION
CONTROL_LOCATION_UPDATES
내가 다른 권한을 추가해야합니까?
어디에서 잘못했는지 알려주세요.