Home > @magiclane/maps-sdk > NavigationService > startNavigation
NavigationService.startNavigation() method
Start a new navigation
Signature:
static startNavigation(route: Route, onNavigationInstructionUpdate?: (eventType: NavigationEventType, instruction?: NavigationInstruction) => void, input?: {
onNavigationInstruction?: (instruction: NavigationInstruction, events: Set<NavigationInstructionUpdateEvents>) => void;
onNavigationStarted?: () => void;
onTextToSpeechInstruction?: (textInstruction: string) => void;
onWaypointReached?: (landmark: Landmark) => void;
onDestinationReached?: (landmark: Landmark) => void;
onRouteUpdated?: (route: Route) => void;
onBetterRouteDetected?: (route: Route, travelTime: number, delay: number, timeGain: number) => void;
onBetterRouteRejected?: (reason: GemError) => void;
onBetterRouteInvalidated?: () => void;
onSkipNextIntermediateDestinationDetected?: () => void;
onTurnAround?: () => void;
onError?: (error: GemError) => void;
onNotifyStatusChange?: (status: NavigationStatus) => void;
onRouteCalculationStarted?: () => void;
onRouteCalculationCompleted?: (error: GemError) => void;
}): TaskHandler | null;Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
route |
Route to use for the navigation. | |
|
onNavigationInstructionUpdate |
(eventType: NavigationEventType, instruction?: NavigationInstruction) => void |
(Optional) Callback for navigation-specific events. |
|
{ onNavigationInstruction, onNavigationStarted, onTextToSpeechInstruction, onWaypointReached, onDestinationReached, onRouteUpdated, onBetterRouteDetected, onBetterRouteRejected, onBetterRouteInvalidated, onSkipNextIntermediateDestinationDetected, onTurnAround, onError, onNotifyStatusChange, onRouteCalculationStarted, onRouteCalculationCompleted, } |
(not declared) |
(Optional) |
|
input |
{ onNavigationInstruction?: (instruction: NavigationInstruction, events: Set<NavigationInstructionUpdateEvents>) => void; onNavigationStarted?: () => void; onTextToSpeechInstruction?: (textInstruction: string) => void; onWaypointReached?: (landmark: Landmark) => void; onDestinationReached?: (landmark: Landmark) => void; onRouteUpdated?: (route: Route) => void; onBetterRouteDetected?: (route: Route, travelTime: number, delay: number, timeGain: number) => void; onBetterRouteRejected?: (reason: GemError) => void; onBetterRouteInvalidated?: () => void; onSkipNextIntermediateDestinationDetected?: () => void; onTurnAround?: () => void; onError?: (error: GemError) => void; onNotifyStatusChange?: (status: NavigationStatus) => void; onRouteCalculationStarted?: () => void; onRouteCalculationCompleted?: (error: GemError) => void; } |
(Optional) |
input properties:
- Optional onNavigationInstruction?: (instruction: NavigationInstruction, events: Set
) => void - Optional onNavigationStarted?: () => void
- Optional onTextToSpeechInstruction?: (textInstruction: string) => void
- Optional onWaypointReached?: (landmark: Landmark) => void
- Optional onDestinationReached?: (landmark: Landmark) => void
- Optional onRouteUpdated?: (route: Route) => void
- Optional onBetterRouteDetected?: (route: Route, travelTime: number, delay: number, timeGain: number) => void
- Optional onBetterRouteRejected?: (reason: GemError) => void
- Optional onBetterRouteInvalidated?: () => void
- Optional onSkipNextIntermediateDestinationDetected?: () => void
- Optional onTurnAround?: () => void
- Optional onError?: (error: GemError) => void
- Optional onNotifyStatusChange?: (status: NavigationStatus) => void
- Optional onRouteCalculationStarted?: () => void
- Optional onRouteCalculationCompleted?: (error: GemError) => void
Returns:
TaskHandler | null
TaskHandler for the navigation session or null if failed
Exceptions
An exception if it fails.