문제

Android / location:

I would like to receive location updates every 5 seconds.

Should I call the method:

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,5000, 0, gpsLocListener)?

It is important for me NOT to interfere with the osmdroid MyLocationManager functionality. Or should I use the MyLocationOverlay.onLocationChanged(), e.g. by inheritance of the MyLocationOverlay class.

If so, how often will it be called?

도움이 되었습니까?

해결책

There should be no problem having multiple listeners on the location manager. Each one will get events separately. In fact, if you wanted you could use a new instance of osmdroid's GpsMyLocationProvider to feed you location updates. Call mGpsMyLocationProvider.startLocationProvider(myLocationConsumer) where myLocationConsumer is an instance of IMyLocationConsumer that receives and handles gps updates as you wish. You can call mGpsMyLocationProvider.setLocationUpdateMinTime() to adjust how often you get updates.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top