2011-11-30 7 views
4

... 지금까지, 너무 좋아 ... 그것은 않습니다 내 위치가 제대로GPS 위치를 자주 업데이트하는 방법은 무엇입니까? 나는 구글지도에 위치를 표시하는 응용 프로그램을 쓰고 있어요

문제는이 GPS가 업데이트되지 않는 것입니다 내가 이동하고있는 경우이다 (또는,하지만 시간이 지나면 만)

누구나 네이티브 Google지도 (안드로이드)와 같은 방식으로이 작업을 수행하는 방법을 알고 있습니까? 당신은 '내 위치'당신이 이동 변경 깜박이는 파란색 점을 보여주고 클릭하면 이

내 코드는 ...입니다 :

//Initializing the listeners   
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 35000, 10, networkLocationListener); 
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 35000, 10, gpsLocationListener); 



//and now, in both 'networkLocationListener' and 'gpsLocationListener' 
//I overwrite the method 'onLocationChanged': 

@Override 
public void onLocationChanged(Location location) { 
    Log.i("test", "New network location: "+location.getLatitude()+ 
        " , "+location.getLongitude()); 
    myLongitude= location.getLongitude(); 
    myLatitude= location.getLatitude(); 
} 

//and the variables myLongitude and myLatitude are the only ones that I need to display my 
//position in the map... 

내가 뭔가를 놓친 경우 누군가가 알고 있습니까 ?

답변

1

영원히 남겨두고 싶지는 않지만 아직 촬영하지 않은 경우 minTime 및 minDistance 값을 0으로 설정하는 것이 좋습니다. minTime가 0보다 큰 경우

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsLocationListener); 

의을 locationManager 잠재적으로 전원을 절약하기 위해 위치 업데이트 사이에 minTime 밀리 초 동안 휴식 수 있습니다. minDistance가 0보다 큰 경우 장치가 minDistance 미터로 이동하는 경우에만 위치가 브로드 캐스팅됩니다. requestLocationUpdates Reference

- 0

모두에 파라미터를 설정, 가능한 한 자주 알림을 구

관련 문제