Device notifications

SDKs covered:
Navigation SDK
Navigation UI SDK

By default, device notifications display the upcoming maneuver icon and instruction text, as well as the distance remaining to said maneuver. This default notification will always be displayed unless otherwise overridden by a custom notification as outlined below.

The method NavigationNotification#updateNotification(RouteProgress routeProgress) will be called every time that the Navigation SDK creates a new RouteProgress update. This is your opportunity to change anything in your notification that you'd like to update. Use a NotificationManager and your notification ID to notify the manager.

Custom notifications

You can also pass in a custom notification when creating MapboxNavigationOptions. This notification will show once navigation begins.

CustomNavigationNotification customNavigationNotification = new CustomNavigationNotification(this);
MapboxNavigationOptions options = MapboxNavigationOptions.builder()

Your notification must implement NavigationNotification:

public class CustomNavigationNotification implements NavigationNotification {
private static final int CUSTOM_NOTIFICATION_ID = 91234821;
private Notification customNotification;
private NotificationCompat.Builder customNotificationBuilder;
private NotificationManager notificationManager;
private int numberOfUpdates;
public CustomNavigationNotification(Context context) {
// Get the notification manager to update your notification
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// Store the builder to update later
customNotificationBuilder = new NotificationCompat.Builder(context, NAVIGATION_NOTIFICATION_CHANNEL)
.setContentTitle("Custom Navigation Notification")
.setContentText("Display your own content here!");
// Build the notification
customNotification = customNotificationBuilder.build();
public Notification getNotification() {
return customNotification;
public int getNotificationId() {
public void updateNotification(RouteProgress routeProgress) {
// Update the builder with a new number of updates
customNotificationBuilder.setContentText("Number of updates: " + numberOfUpdates++);
// Notify the notification manager
notificationManager.notify(CUSTOM_NOTIFICATION_ID, customNotificationBuilder.build());