SlowTrafficNotificationProvider

class SlowTrafficNotificationProvider(var options: SlowTrafficNotificationOptions = SlowTrafficNotificationOptions.Builder().build()) : DriverNotificationProvider

Provides notifications for slow traffic conditions along the route.

The SlowTrafficNotificationProvider generates SlowTrafficNotification instances when slow traffic is detected on the current route. It evaluates traffic conditions based on route progress and configurable options, such as congestion thresholds and traffic delay tolerances.

This provider listens to route progress updates and identifies slow traffic segments by analyzing congestion levels, distances, and durations. Notifications are generated when the delay caused by slow traffic exceeds the configured threshold.

Required Annotations from the navigation backend:

  • Distance (List<Double>, from LegAnnotation.distance): The distance of each geometry segment in meters, used to calculate the total affected distance.

  • Duration (List<Double>, from LegAnnotation.duration): The duration of each geometry segment in seconds, used to calculate the total affected time.

  • Free-flow speed (List<Integer?>, from LegAnnotation.freeflowSpeed): The speed under free-flow conditions for each geometry segment in km/h, used to estimate the free-flow duration.

  • Congestion numeric (List<Integer?>, from LegAnnotation.congestionNumeric): The congestion level for each geometry segment as a numeric value, used to identify slow traffic conditions.

Parameters

options

configuration options for the provider

See also

for the notification generated by this provider

for configuring the provider

Constructors

Link copied to clipboard
constructor(options: SlowTrafficNotificationOptions = SlowTrafficNotificationOptions.Builder().build())

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun onAttached(mapboxNavigation: MapboxNavigation)

Attaches the MapboxNavigation instance to the provider.

Link copied to clipboard
open override fun onDetached(mapboxNavigation: MapboxNavigation)

Detaches the MapboxNavigation instance from the provider.

Link copied to clipboard
open override fun trackNotifications(): Flow<DriverNotification>

Tracks notifications for slow traffic conditions.