Search code examples
androidapigeolocationmapbox

MapBox User Location Icon (Android)


I use MapBox for my Android App, and I need to modify the standard blue "dot" that is used to indicate the current user location and orientation.

I found this thread indicating that past MapBox Android APIs offered methods to modify the User Location Icon: https://github.com/mapbox/mapbox-android-sdk-legacy/issues/717

The thread mentions these methods:

mapView.getUserLocationOverlay().setDirectionArrowBitmap();
mapView.getUserLocationOverlay().setPersonBitmap();

The newest MapBox Android SDK does not show these methods. Does anyone know replacements for these methods or alternatives to modifying the User Location Icon?

The maven archive is here: http://grepcode.com/file/repo1.maven.org/maven2/com.mapbox.mapboxsdk/mapbox-android-sdk/0.7.4/com/mapbox/mapboxsdk/overlay/UserLocationOverlay.java#UserLocationOverlay.setDirectionArrowBitmap%28com.mapbox.mapboxsdk.overlay.Bitmap%29


Solution

  • MapBox responded to a request to clarify replacements for these methods, saying:

    As for changing location of a custom Marker to show movement, the best bet is to add and remove Markers when you need to show progress. Depending on how quickly you need to refresh the location, this approach might look a bit choppy, but it is the best workaround at this point. This would be done via

    MapView.addMarker()
    

    and

    MapView.removeAnnotation()
    

    That is not an ideal solution, but it should get the job done for now.