# Landmark and overlay alarms

Last updated:

<!-- -->

October 18, 2026

<!-- -->

\| 6 minutes read

<br />

<br />

This guide explains how to configure notifications when approaching specific landmarks or overlay items within a defined proximity.

The `AlarmService` can be configured to send notifications when approaching specific landmarks or overlay items within a defined proximity. This behavior can be tailored to trigger notifications exclusively during navigation or simulation modes, or while freely exploring the map without a predefined route.

Use cases include:

* Notify users about incoming reports such as speed cameras, police, accidents, or other road hazards
* Notify users when approaching points of interest, such as historical landmarks, monuments, or scenic viewpoints
* Notify users about traffic signs such as stop and give way signs

Tip

You can search for landmarks along the active route, whether in navigation or simulation mode, using specific categories or other criteria. Once identified, these landmarks can be added for monitoring. Be sure to account for potential route deviations.

warning

If notifications are not sent via the `AlarmListener`, make sure that:

* The `AlarmService` and `AlarmListener` are properly initialized and are kept alive
* The `alarmDistance` and `monitorWithoutRoute` properties are configured as needed
* The stores/overlays to be monitored are **successfully** added to the `AlarmService`
* The overlay items are on the correct side of the road. If the items are on the opposite side of the road, notifications will not be triggered

## Configure alarm distance[​](#configure-alarm-distance "Direct link to Configure alarm distance")

The distance threshold measured in meters for triggering notifications when approaching a landmark or overlay item can be obtained as follows:

```dart
double alarmDistance = alarmService.alarmDistance;

```

This threshold can also be adjusted as needed. To configure the alarm service to start sending notifications when within 200 m of one of the monitored items:

```dart
alarmService.alarmDistance = 200;

```

## Configure alarms without active navigation[​](#configure-alarms-without-active-navigation "Direct link to Configure alarms without active navigation")

The `AlarmService` can be configured to control whether notifications about approaching landmarks or overlay items are triggered exclusively during navigation (or navigation simulation) on a predefined route, or if they should also occur while freely exploring the map without an active navigation session.

To enable notifications for monitored landmarks at all times, regardless of whether navigation is active:

```dart
alarmService.monitorWithoutRoute = true;

```

To access the value of this preference:

```dart
bool isMonitoringWithoutRoute = alarmService.monitorWithoutRoute;

```

## Landmark alarms[​](#landmark-alarms "Direct link to Landmark alarms")

### Configure alarm listeners[​](#configure-alarm-listeners "Direct link to Configure alarm listeners")

You are notified through the `onLandmarkAlarmsUpdated` and `onLandmarkAlarmsPassedOver` callbacks when approaching the specified landmarks and when the landmarks have been passed, respectively.

To retrieve the next landmark to be intercepted and the distance to it, and detect when a landmark has been passed:

```dart
AlarmListener alarmListener = AlarmListener(
    onLandmarkAlarmsUpdated: () {
        // The landmark alarm list containing the landmarks that are to be intercepted
        LandmarkAlarmsList landmarkAlarms = alarmService!.landmarkAlarms;

        // The landmarks and their distance from the reference position
        // Sorted ascending by distance from the current position
        List<LandmarkPosition> items = landmarkAlarms.items;

        // The closest landmark and its associated distance (in meters)
        LandmarkPosition closestLandmark = items.first;
        Landmark landmark = closestLandmark.landmark;
        int distance = closestLandmark.distance;

        showSnackbar("The landmark ${landmark.name} is $distance meters away");
    },
    onLandmarkAlarmsPassedOver: () {
        showSnackbar("Landmark was passed over");

        // The landmarks that were passed over
        LandmarkAlarmsList landmarkAlarmsPassedOver = alarmService!.landmarkAlarmsPassedOver;

        // Process the landmarks that were passed over ...
    },
);

```

info

The `onLandmarkAlarmsUpdated` callback is continuously triggered once the threshold distance is exceeded, until the landmark is intercepted. The `onLandmarkAlarmsPassedOver` callback is called once when the landmark is intercepted.

warning

The items within `landmarkAlarmsPassedOver` do not have a predefined sort order. To identify the most recently passed landmark, compare the current list of items with the previous list of `landmarkAlarmsPassedOver` entries.

### Specify landmarks to monitor[​](#specify-landmarks-to-monitor "Direct link to Specify landmarks to monitor")

Landmarks can be defined and added to the `AlarmService` for monitoring. You will receive notifications through the `onLandmarkAlarmsUpdated` callback when approaching specified landmarks.

```dart
// Create landmarks to monitor
Landmark landmark1 = Landmark()
    ..name = "Landmark 1"
    ..coordinates = Coordinates(latitude: 49.0576, longitude: 1.9705);

Landmark landmark2 = Landmark()
    ..name = "Landmark 2"
    ..coordinates = Coordinates(latitude: 43.7704, longitude: 1.2360);

// Create landmark store and add the landmarks
LandmarkStore landmarkStore = LandmarkStoreService.createLandmarkStore("Landmarks to be monitored");
landmarkStore.addLandmark(landmark1);
landmarkStore.addLandmark(landmark2);

// Monitor the landmarks
alarmService.landmarks.add(landmarkStore);

```

Multiple `LandmarkStore` instances can be added to the monitoring list simultaneously. These stores can be updated later by modifying the landmarks within them or removed from the monitoring list as needed.

## Overlay alarms[​](#overlay-alarms "Direct link to Overlay alarms")

The workflow for overlay items is similar to that for landmarks, with comparable behavior and functionality. Notifications for overlay items are triggered in the same way as for landmarks, based on proximity or other criteria. The steps for monitoring and handling events related to overlay items align with those for landmarks. All the notices specified above for landmarks are also applicable for overlay items.

warning

To enable overlay alarms, a `GemMap` widget must be created, and a style containing the overlay to be monitored should be applied. Additionally, the overlay needs to be enabled for the alarms to function properly.

### Configure alarm listeners[​](#configure-alarm-listeners-1 "Direct link to Configure alarm listeners")

To retrieve the next overlay item to be intercepted and the distance to it, and detect when an overlay item has been passed:

```dart
AlarmListener alarmListener = AlarmListener(
    onOverlayItemAlarmsUpdated: () {
        // The overlay item alarm list containing the overlay items that are to be intercepted
        OverlayItemAlarmsList overlayItemAlarms =
            alarmService!.overlayItemAlarms;

        // The overlay items and their distance from the reference position
        // Sorted ascending by distance from the current position
        List<OverlayItemPosition> items = overlayItemAlarms.items;

        // The closest overlay item and its associated distance
        OverlayItemPosition closestOverlayItem = items.first;
        OverlayItem overlayItem = closestOverlayItem.overlayItem;
        int distance = closestOverlayItem.distance;

        showSnackbar("The overlay item ${overlayItem.name} is $distance meters away");
    },
    onOverlayItemAlarmsPassedOver: () {
        // The overlay items that were passed over
        OverlayItemAlarmsList overlayItemAlarmsPassedOver = alarmService!.overlayItemAlarmsPassedOver;

        // Process the overlay items that were passed over ...

        showSnackbar("Overlay item was passed over");
    },
);

```

### Specify overlays to monitor[​](#specify-overlays-to-monitor "Direct link to Specify overlays to monitor")

The workflow for specifying the overlay items to be monitored is different from the workflow for landmarks. Instead of specifying the landmarks one by one, the overlay items are specified as a whole, based on the overlay and the overlay categories.

To add the social reports overlay (containing police reports and road hazards) to be monitored:

```dart
int socialReportsOverlayId = CommonOverlayId.socialReports.id;
alarmService.overlays.add(socialReportsOverlayId);

```

## Relevant example demonstrating overlay alarms related features[​](#relevant-example-demonstrating-overlay-alarms-related-features "Direct link to Relevant example demonstrating overlay alarms related features")

* [Route Alarms](/docs/flutter/examples/routing-navigation/route-alarms.md)
