Select platform: [Android](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions "View this page for the Android platform docs.") [iOS](https://developers.google.com/maps/documentation/navigation/ios-sdk/real-time-disruptions "View this page for the iOS platform docs.")

<br />

# 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.

> [!NOTE]
> **Note:** The availability of real-time disruption features and of specific disruption types vary by region. For more information, see [Navigation SDK country and region coverage](https://developers.google.com/maps/documentation/navigation/android-sdk/coverage-nav-sdk). In addition, real-time disruptions are not available on Android Auto.

## 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](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#disruption-callouts).
- [Automated disruption alerts with voting during active navigation](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#automated-alerts).
- [Disruption reporting during active navigation](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#reporting-button).

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. When you enable the traffic layer, off-route disruptions also appear on the map. Callouts include an icon that indicates the type of disruption.
![Callouts along routes](https://developers.google.com/static/maps/documentation/navigation/android-sdk/images/callouts-along-routes.png)


You can control the display of disruption callouts along routes using [`setTrafficPromptsEnabled`](https://developers.google.com/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/SupportNavigationFragment#setTrafficPromptsEnabled(boolean)), which also controls the [display of automated alerts when a user approaches a disruption](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#automated-alerts).

```java
// Using the SupportNavigationFragment
mNavFragment.setTrafficPromptsEnabled(true);

// Using the NavigationView
navigationView.setTrafficPromptsEnabled(true);
```

> [!NOTE]
> **Notes:**
>
> - `setTrafficPromptsEnabled` only controls the display of callouts for user-reported disruptions. Some disruption types, such as road closures from traffic authorities, may still be visible even when `setTrafficPromptsEnabled` is set to `false`.
> - Road closure callouts appear on both the current route and alternate routes.

### Display disruption details when a user taps a callout

Tapping a disruption callout opens an info card with more details. This applies to both on-route and off-route callouts, though off-route callouts only appear if the traffic layer is enabled. The card displays the disruption type, the time it was last reported, and sometimes an option to vote on whether the disruption is still present. The info card type and its configuration options vary depending on whether the user is in active navigation.

#### Callout info cards on route overviews, prior to starting active navigation

Before starting active navigation, users can tap an on-route or off-route callout on the map or route overview to open an info card. Off-route callouts require the traffic layer to be enabled. The info card provides more details about the disruption.
![Overview info card](https://developers.google.com/static/maps/documentation/navigation/android-sdk/images/overview-info-card.png)


You can control the ability of users to tap disruption callouts on route overviews to display more
information using
[`setTrafficIncidentCardsEnabled`](https://developers.google.com/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/SupportNavigationFragment#setTrafficIncidentCardsEnabled(boolean))
.

```java
// Using the SupportNavigationFragment
mNavFragment.setTrafficIncidentCardsEnabled(true);

// Using the NavigationView
navigationView.setTrafficIncidentCardsEnabled(true);
```

#### Callout info cards during active navigation


During active navigation, users can tap an on-route or off-route disruption callout to open an info card. The card shows the disruption type and the last reported time, and it includes buttons for users to vote on whether the disruption is still present.


Voting is available for on-route and off-route disruptions within 5 km of the user excluding road closures. Google processes these votes to help determine whether to continue showing the disruption. The votes may also appear on the map for other Google Maps and Navigation SDK users.
![Active navigation info card](https://developers.google.com/static/maps/documentation/navigation/android-sdk/images/active-nav-info-card.png)


You can control the display and tappability of disruption callouts during active navigation using
[`setTrafficPromptsEnabled`](https://developers.google.com/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/SupportNavigationFragment#setTrafficPromptsEnabled(boolean))
, which also controls the
[display of callouts along routes](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#disruption-callouts) and the
[display of automated alerts when a user approaches a disruption](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#automated-alerts).

```java
// Using the SupportNavigationFragment
mNavFragment.setTrafficPromptsEnabled(true);

// Using the NavigationView
navigationView.setTrafficPromptsEnabled(true);
```

> [!NOTE]
> **Note:** `setTrafficPromptsEnabled` only controls the display of callouts for user-reported disruptions. Some disruption types, such as road closures from traffic authorities, may still be visible even when `setTrafficPromptsEnabled` is set to `false`.

## 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.
![Active navigation info card](https://developers.google.com/static/maps/documentation/navigation/android-sdk/images/active-nav-info-card.png)


You can configure the display of alert prompts during active navigation using
[`setTrafficPromptsEnabled`](https://developers.google.com/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/SupportNavigationFragment#setTrafficPromptsEnabled(boolean))
, which also controls the display
of [callouts along routes](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#disruption-callouts).

```java
// Using the SupportNavigationFragment
mNavFragment.setTrafficPromptsEnabled(true);

// Using the NavigationView
navigationView.setTrafficPromptsEnabled(true);
```

> [!NOTE]
> **Note:** When a user approaches a disruption along a route during active navigation, the disruption is announced with an audio alert. Audio alerts are not affected by the prompt display configuration. However, you can configure all voice prompts during active navigation using [`AudioGuidance`](https://developers.google.com/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/Navigator.AudioGuidance) .

## 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.


Reporting a road closure may present an alternate route to bypass the blocked segment, prompting the user to confirm or deny the reroute. This feature is subject to availability.
![Reporting button](https://developers.google.com/static/maps/documentation/navigation/android-sdk/images/reporting-button.png) ![Reporting menu](https://developers.google.com/static/maps/documentation/navigation/android-sdk/images/reporting-menu.png)

> [!NOTE]
> **Note:** When a user first starts active navigation, the reporting button appears in an expanded state with the label "Report". The button then collapses to only show the icon.

### Show or hide the standard reporting button


You can configure the visibility of the standard reporting button during active navigation using
`setReportIncidentButtonEnabled`
.

```java
// 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);
```

### Add a custom reporting button


In place of the standard disruption reporting button, you can add a custom reporting button to the
navigation UI. When the user clicks the custom button, you can trigger the display of the reporting
menu by calling the `showReportIncidentsPanel` method. Before adding a custom reporting
button, verify that the app is in active navigation and the user is in a country where reporting
is enabled by calling `isIncidentReportingAvailable`. If either of these is not true,
the reporting menu won't appear.

> [!NOTE]
> **Note:** If you are implementing a custom reporting button, make sure to set `setReportIncidentButtonEnabled` to `false` to hide the standard reporting button.

```java
  Button customReportIncidentButton = findViewById(R.id.custom_reporting_button);
  
  // Check if reporting is available before displaying your button
  customReportIncidentButton.setVisibility(
      navigationView.isReportingAvailable ? View.VISIBLE : View.GONE);
  
  // Trigger the reporting flow if the button is clicked
  customReportIncidentButton.setOnClickListener(v ->
      navigationView.showReportIncidentsPanel());
  
```

## 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.

> [!NOTE]
> **Note:** For more information about working with custom UI elements, see [Modify the navigation UI](https://developers.google.com/maps/documentation/navigation/android-sdk/controls).

### 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 a `BOTTOM_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](https://developers.google.com/maps/documentation/navigation/android-sdk/real-time-disruptions#prompt-visibility-api) to manage potential UI conflicts.

> [!NOTE]
> **Note:** The `FOOTER` custom control only affects the position of the reporting button in portrait orientation.

### 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.

```java
// 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)
```