Configure real-time disruptions
Real-time disruptions are a collection of features that alert users about disruptions along their route and allow users to report and verify disruptions that they encounter. Examples of disruptions include vehicle accidents, traffic congestion, police and speed camera presence, construction, lane closures, and certain weather conditions. This page explains the real-time disruption features and their configuration options, including considerations for apps that use custom navigation UIs.
Real-time disruption features
The Navigation SDK includes the following real-time disruption features as part of the core navigation experience:- Interactive disruption callouts along routes.
- Automated disruption alerts with voting during active navigation.
- Disruption reporting during active navigation.
These features are configurable and enabled by default. The following sections provide more information about the features and available configuration options.
Interactive disruption callouts along routes
When an app displays a route, either in a route overview or during active navigation, any current disruptions appear as callouts along the route. Callouts include an icon that indicates the type of disruption.

You can control the display of disruption callouts along routes using setTrafficPromptsEnabled
, which also controls the display of automated alerts when a user approaches a disruption.
// Using the SupportNavigationFragment mNavFragment.setTrafficPromptsEnabled(true); // Using the NavigationView navigationView.setTrafficPromptsEnabled(true);
Display disruption details when a user taps a callout
Users can tap a callout to display an info card with more information about the disruption, including the disruption type, the time it was last reported, and in some cases, an option for voting on whether the disruption is still present. There are two different types of info cards that may appear, depending on whether the user is in active navigation, and the configuration options vary for each type.
Callout info cards on route overviews, prior to starting active navigation
When a user taps a callout on a route overview, prior to starting active navigation, an info card appears with more information about the disruption.

You can control the ability of users to tap disruption callouts on route overviews to display more
information using
setTrafficIncidentCardsEnabled
.
// Using the SupportNavigationFragment mNavFragment.setTrafficIncidentCardsEnabled(true); // Using the NavigationView navigationView.setTrafficIncidentCardsEnabled(true);
Callout info cards during active navigation
When a disruption callout appears along a route during active navigation, users can tap the callout to display an info card with more information about the disruption, including the disruption type and the time it was last reported, as well as buttons for voting on whether the disruption is still present. Votes submitted by users are processed by Google and may be surfaced on the map for other Google Maps users and Navigation SDK users, as well as used to determine whether to continue showing the disruption.

You can control the display and tappability of disruption callouts during active navigation using
setTrafficPromptsEnabled
, which also controls the
display of callouts along routes and the
display of automated alerts when a user approaches a disruption.
// Using the SupportNavigationFragment mNavFragment.setTrafficPromptsEnabled(true); // Using the NavigationView navigationView.setTrafficPromptsEnabled(true);
Automated disruption alerts with voting during active navigation
During active navigation, when a user approaches a disruption along a route, a prompt appears with information about the disruption and buttons for voting on whether the disruption is still present. Votes submitted by users are processed by Google and may be surfaced on the map for other Google Maps and Navigation SDK users, as well as used to determine whether to continue showing the disruption.

You can configure the display of alert prompts during active navigation using
setTrafficPromptsEnabled
, which also controls the display
of callouts along routes.
// Using the SupportNavigationFragment mNavFragment.setTrafficPromptsEnabled(true); // Using the NavigationView navigationView.setTrafficPromptsEnabled(true);
Disruption reporting during active navigation
During active navigation mode, a button appears on the navigation UI that allows users to report new disruptions along their route. When a user taps the button, a menu with the available disruption types to report appears. Reports that users submit are processed by Google and may be surfaced on the map for other Google Maps and Navigation SDK users.


You can configure the visibility of the reporting button during active navigation using
setReportIncidentButtonEnabled
.
// Enables the incident reporting button to show in situations where incident // reporting is possible. // Using the SupportNavigationFragment mNavFragment.setReportIncidentButtonEnabled(true); // Using the NavigationView navigationView.setReportIncidentButtonEnabled(true);
Work with custom navigation UIs
If your implementation of the Navigation SDK includes custom UI elements, you need to consider the real-time disruption elements in order to avoid conflicts.
Reporting button positioning
By default, the disruption reporting button is positioned at the bottom end/trailing corner of the map—on the right side for left-to-right languages and left side for right-to-left languages. If you need to move the reporting button to make space for custom UI elements, add aBOTTOM_END_BELOW
or FOOTER
custom control, which will push the
position of the button up on the screen. Placing your own custom UIs within the custom controls
also ensures that any prompts displayed by the Navigation SDK are properly layered over your
custom UI elements while displayed. If you are not able to use custom controls, use the
Prompt Visibility API to manage potential UI conflicts.
Prompt Visibility API (Experimental)
The Prompt Visibility API helps you avoid conflicts between UI elements generated by the Navigation SDK and your own custom UI elements by adding a listener to receive a callback before a Navigation SDK UI element is about to appear and as soon as the element is removed. You can receive callbacks for real-time disruption elements, including info cards, prompts, and the disruption reporting menu—as well as for other notifications generated by the Navigation SDK.// Sample listener val listener: PromptVisibilityChangedListener = { isVisible -> if (isVisible) { customFab.visibility = false customFooter.visibility = false moveSomeOtherThingsAround() } else { customFab.visibility = true customFooter.visibility = true moveSomeThingsBackToWhereTheyWereBefore() } } // Inside onCreate() navigationView.addPromptVisibilityChangedListener(listener) // Inside onDestroy() navigationView.removePromptVisibilityChangedListener(listener)