Reputation: 7591
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?
Upvotes: 0
Views: 859
Reputation: 3137
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.
Upvotes: 1