Overriding location-tracking in OSMdroid

I'm wondering how to override where OSMdroid derives its location from. In my app, I am already tracking and storing the user's location, so doing it twice (OSMdroid, and my app is redundant). Is it worth the effort in terms of battery-life to change the source of OSMdroid's location to my location-tracker? IF IT IS, does anyone have an insight into how I might do this. OSMdroid is currently added to my project via Gradle. Just trying to do some research before implementing it.



answered 6 months ago MKer #1

In osmdroid, you are not obliged to put a "MyLocationNewOverlay" on the map. In this case, osmdroid will do nothing about location.

If you still want a graphical representation on the map about your current location/orientation/precision, you can use a DirectedLocationOverlay. You will have to "refresh" it yourself - typically with your own tracking and storing code. Example here.

comments powered by Disqus