AlarmService class Routes & Navigation

Provides monitoring and notification for navigation-related alarm events.

The AlarmService manages a variety of alarm types including speed limit violations, landmark proximity alerts, overlay item notifications (such as safety cameras and social reports), geographic boundary crossings, tunnel entry/exit events, and day/night mode transitions. Configure the service with an AlarmListener to receive callbacks for these events.

Multiple AlarmService and AlarmListener instances can operate simultaneously, enabling concurrent monitoring of different events or areas.

Make sure to keep a reference to both the AlarmService and AlarmListener instances for as long as you want to receive alarm notifications. If either instance is garbage collected, alarm callbacks will stop being triggered.

Example

AlarmService? alarmService;

// Create an alarm listener with callbacks
AlarmListener alarmListener = AlarmListener(
  onHighSpeed: (limit, insideCityArea) {
    print('Speed limit exceeded: $limit m/s');
  },
  onLandmarkAlarmsUpdated: () {
    LandmarkAlarmsList landmarkAlarms = alarmService!.landmarkAlarms;
    print('Approaching ${landmarkAlarms.items.first.landmark.name}');
  },
);

// Create the alarm service
alarmService = AlarmService(alarmListener);

// Trigger alarms within 200m and monitor even without active navigation
alarmService.alarmDistance = 200;
alarmService.monitorWithoutRoute = true;

See also:

Constructors

AlarmService.new(AlarmListener listener)
Creates an AlarmService instance that notifies the provided listener of alarm events.
factory

Properties

alarmDistance double
Distance threshold in meters for triggering landmark and overlay item alarms.
getter/setter pair
alarmListener AlarmListener
Updates the alarm listener for this service.
no getter
hashCode int
The hash code for this object.
no setterinherited
insideAreas List<AlarmMonitoredArea>
Monitored areas containing the current reference position.
no setter
landmarkAlarms LandmarkAlarmsList
Active landmark alarms sorted by distance from the reference position.
no setter
landmarkAlarmsPassedOver LandmarkAlarmsList
Landmark alarms that have been passed over.
no setter
landmarks LandmarkStoreCollection
Collection of landmark stores to monitor for proximity alarms.
no setter
monitoredAreas List<AlarmMonitoredArea>
All currently monitored geographic areas.
no setter
monitorWithoutRoute bool
Whether alarms are triggered when navigating without an active route.
getter/setter pair
outsideAreas List<AlarmMonitoredArea>
Monitored areas not containing the current reference position.
no setter
overlayItemAlarms OverlayItemAlarmsList
Active overlay item alarms sorted by distance from the reference position.
no setter
overlayItemAlarmsPassedOver OverlayItemAlarmsList
Overlay item alarms that have been passed over.
no setter
overlays OverlayMutableCollection
Collection of overlays to monitor for proximity alarms.
no setter
pointerId int
The pointer ID of the native object
no setterinherited
referencePosition GemPosition?
Current reference position used for alarm calculations.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
trackedPositionSource DataSource
Data source used for tracking the reference position.
no setter

Methods

dispose() → void
Disposes the native object.
inherited
getOverSpeedThreshold(bool insideCityArea) double
Gets the configured overspeed threshold for high-speed alarms.
monitorArea(GeographicArea area, {String id = ''}) → void
Adds a geographic area to monitor for boundary crossing events.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerAutoReleaseObject(int pointerId) → void
Registers an object for auto release.
inherited
setOverSpeedThreshold({required double threshold, required bool insideCityArea}) → void
Sets the overspeed threshold for triggering high-speed alarms.
toString() String
A string representation of this object.
inherited
unmonitorAllAreas() → void
Removes all monitored geographic areas.
unmonitorArea(GeographicArea area) → void
Removes a geographic area from monitoring.
unmonitorAreasByIds(List<String> ids) → void
Removes multiple geographic areas from monitoring by their IDs.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

isSafetyCameraEnabled bool
Checks whether the safety camera overlay is enabled.
no setter
isSocialReportsEnabled bool
Checks whether the social reports overlay is enabled.
no setter

Static Methods

disableSafetyCamera() GemError
Disables the safety camera overlay.
disableSocialReports() GemError
Disables the social reports overlay.
disableSocialReportsWithCategory(int categoryId) GemError
Disables the social reports overlay for a specific category.
enableSafetyCamera() GemError
Enables the safety camera overlay for display and alarm monitoring.
enableSocialReports() GemError
Enables the social reports overlay for display and alarm monitoring.
enableSocialReportsWithCategory(int categoryId) GemError
Enables the social reports overlay for a specific category.
isSocialReportsEnabledWithCategory(int categoryId) bool
Checks whether the social reports overlay is enabled for a specific category.