안드로이드 개발 질문/답변
(글 수 45,052)
locationManager = (LocationManager) this
.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
if(!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
Log.i(TAG,"NEED Wi-fi to get your location!");
WifiManager wifimgr = (WifiManager) getSystemService(WIFI_SERVICE);
if (wifimgr != null) {
if (!wifimgr.isWifiEnabled()) {
wifimgr.setWifiEnabled(true);
}
Log.e(TAG,"Wi-fi ON Completed!");
}
try {
Thread.sleep(8000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
provider = LocationManager.NETWORK_PROVIDER;
locationManager.requestLocationUpdates(provider, 10000, 100,
new MyLocationListener());
} else {
Log.i(TAG,"NOT NEED Wi-fi to get your location!");
locationManager.requestLocationUpdates(provider, 10000, 70,
new MyLocationListener());
}
location = locationManager.getLastKnownLocation(provider);
if (location == null) {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
location = locationManager.getLastKnownLocation(provider);
}
myLocation = new NGeoPoint(location.getLongitude(), location.getLatitude());
locationThreadStop = true;
이렇게 위치정보를 가져오는데 GPS기능을 켜놔도 오차가 심합니다. 어떻게 해야 정확도를 높일 수 있을까요?
1. 실내경우 GPS가 동작을 안해서 WIFI로 잡는데..이건 다소 오차가 있습니다.
2. GPS경우도 몇 M정도는 오차가 있습니다.