Our latest Android SDK release introduces powerful, customizable marker views, new ways to customize your user location layer, the Mapbox account manager, and much more.

Marker views

Marker views are a new type of annotation that takes advantage of the Android view class, giving you more flexibility when marking locations on the map. When you add a marker view to your map, you can use MarkerViewOptions() to customize the marker’s rotation, alpha, and anchor, and even make it lie flat against a tilted map. If these options aren’t enough for your use case, you can extend MarkerViewAdapter and customize the marker further.

With 4.1.0, animating the marker position is significantly smoother and can be done with a few steps:

// Include these three lines where you'd like to animate the marker
ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position",
        new LatLngEvaluator(), marker.getPosition(), endPosition);

// Include method in your activity
private static class LatLngEvaluator implements TypeEvaluator<LatLng> {

    private LatLng latLng = new LatLng();
    public LatLng evaluate(float fraction, LatLng startValue, LatLng endValue) {
        latLng.setLatitude(startValue.getLatitude() +
                ((endValue.getLatitude() - startValue.getLatitude()) * fraction));
        latLng.setLongitude(startValue.getLongitude() +
                ((endValue.getLongitude() - startValue.getLongitude()) * fraction));
        return latLng;

User location customization

We’re also giving you more control over the appearance of the user location layer. With this release, you’ll be able to change the user location’s color, alpha, and padding. Want to mark the user location with something other than a dot? Now you can replace it with a drawable of your choice. To get to all these settings, use the MapboxMap.getMyLocationViewSettings() object.

To keep your custom user location layer looking good, we’ve focused on improving the transition between GPS updates. With 4.1.0, location updates look better than ever.

Mapbox account manager

4.1.0 adds a new, centralized location for storing your Mapbox access token in your Android application. This means you’ll only need to set your access token once, either in your app’s custom application object or the app’s launching activity.

MapboxAccountManager.start(context, "Mapbox Access Token");

Get started

Download the revamped Android Demo App from the Play Store to try out the new marker view and user location features. Then head over to the documentation page to learn how to include the SDK in your app today!