Route Alarms
This example demonstrates how to calculate a route with overlay items, simulate navigation along it, and receive real-time alarm notifications when approaching hazards or points of interest.
Overview
The example demonstrates the following features:
- Calculating routes containing social reports or overlay items
- Setting up alarm listeners to track proximity to overlay items
- Simulating navigation with alarm notifications
- Displaying alarm information with distance and images
- Managing alarm service with configurable alarm distance
Code Implementation
Importing SDK Components
Setting Up Alarm Listener
Starting Navigation Simulation
Searching for Overlay Items
Calculating Route with Reports
Rendering Route on Map
Live Demo
Key Features
- Alarm Listener: Monitor proximity to overlay items during navigation with customizable callbacks
- Alarm Service: Configure alarm distance threshold and track multiple overlay types
- Overlay Item Search: Search for social reports and other overlay items within geographic areas
- Route Calculation: Calculate routes that include overlay items as waypoints
- Navigation Simulation: Simulate navigation along routes with real-time alarm updates
- Visual Feedback: Display alarm information including distance and overlay item images
Explanation of Key Components
- AlarmListener: Interface for receiving notifications when approaching or passing overlay items during navigation
- AlarmService: Service that monitors position relative to overlay items and triggers alarms based on distance threshold
- alarmDistance: Configurable property defining the distance (in meters) at which alarms are triggered
- onOverlayItemAlarmsUpdated: Callback invoked when alarm list is updated, providing sorted list of nearby overlay items
- onOverlayItemAlarmsPassedOver: Callback triggered when all active alarms have been passed
- SearchService.searchInArea(): Search for landmarks and overlay items within a defined geographic area
- RouteRenderSettings: Configures route visualization options including traffic and highlights
- NavigationService.startSimulation(): Begins simulated navigation with navigation instruction callbacks
Next Steps
- Navigate Route - Learn basic route navigation features
- Simulate Navigation - Explore navigation simulation options
- Route Instructions - Display turn-by-turn navigation instructions