Reputation: 910
Using Mapboxs Android SDK it is possible to show the devices location in the form of a "blue dot" (see picture below). In my application I use a custom method for computing the users location. Is it possible to provide my own location coordinates as the devices location, instead of using the default location when showing the device location? If so, how?
Upvotes: 0
Views: 665
Reputation: 2546
Yep!
mapboxMap.getLocationComponent().forceLocationUpdate()
is what you want to use. You can see this method in action in https://docs.mapbox.com/android/maps/examples/location-change-listening/ (specifically at https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/location/LocationChangeListeningActivity.java#L186).
You should pass through a Location
object and then the Mapbox Maps SDK for Android will move the LocationComponent
puck to those coordinates.
Upvotes: 1