A singleton which provides methods for controlling navigation.
All methods are guaranteed to be thread-safe except for setAudioGuidance(int)
and
setHeadsUpNotificationEnabled(boolean)
which must be called on the UI thread.
Nested Class Summary
interface | Navigator.ArrivalListener | Defines signatures for methods that are called when the driver arrives at a waypoint. | |
@interface | Navigator.AudioGuidance | AudioGuidance is a set of flags used to specify what kinds of audio alerts and guidance are used during navigation. | |
interface | Navigator.NavigationSessionListener | Defines signatures for methods that are called when a new navigation session starts. | |
interface | Navigator.RemainingTimeOrDistanceChangedListener | Defines signatures for methods that are called when the remaining time or distance to the next destination changes. | |
interface | Navigator.ReroutingListener | Defines signature for methods called when rerouting is requested in response to the vehicle going off the suggested route. | |
interface | Navigator.RouteChangedListener | Defines signatures for methods that are called when the route changes. | |
enum | Navigator.RouteStatus | A RouteStatus is a status code that represents the result of a route calculation, accessed via
the Future returned by Navigator.setDestination(Waypoint) . |
|
@interface | Navigator.TaskRemovedBehavior | TaskRemovedBehavior is a set of constants that may be passed to Navigator.setTaskRemovedBehavior(int) to configure how the background service responds when the user
removes away the application's task from Android's recents screen. |
|
interface | Navigator.TrafficUpdatedListener | Defines signatures for methods that are called when the route's traffic data gets updated. |
Constant Summary
int | MAX_NUM_TRANSACTION_IDS | |
int | MAX_TRANSACTION_ID_LENGTH |
Public Method Summary
abstract void | |
abstract void |
addNavigationSessionListener(Navigator.NavigationSessionListener listener)
Registers a listener for new navigation sessions.
|
abstract void |
addRemainingTimeOrDistanceChangedListener(int timeChangeThresholdSeconds, int distanceChangeThresholdMeters, Navigator.RemainingTimeOrDistanceChangedListener listener)
Registers a listener for when the remaining time or distance to the destination changes by more
than a specified threshold.
|
abstract void |
addReroutingListener(Navigator.ReroutingListener listener)
Registers a listener for route change that is requested in response to vehicle going off the
suggested route.
|
abstract void |
addRouteChangedListener(Navigator.RouteChangedListener listener)
Registers a listener for route changed events.
|
abstract void |
addTrafficUpdatedListener(Navigator.TrafficUpdatedListener listener)
Registers a listener for traffic update events.
|
abstract void |
cleanup()
Cleans up internal state of the Navigator.
|
abstract void |
clearDestinations()
Clears all previously set destinations and removes any calculated routes from the map.
|
abstract void |
clearLicensePlateRestrictionInfo()
Clears license plate information about the current driver.
|
abstract Waypoint |
continueToNextDestination()
Removes the current destination.
|
abstract ListenableResultFuture<RouteInfo> |
fetchRouteInfo(Waypoint waypoint, RoutingOptions routingOptions)
This method is deprecated.
Prior to being deprecated, this method was only available to Mobility
Services customers. Please use the
|
abstract RouteSegment |
getCurrentRouteSegment()
Returns the current segment of the journey.
|
abstract TimeAndDistance |
getCurrentTimeAndDistance()
Returns the estimated time and distance from the current position to the current destination.
|
abstract List<RouteSegment> |
getRouteSegments()
Returns a list of route segments.
|
abstract Simulator |
getSimulator()
Returns a Simulator object, for use during testing.
|
abstract List<TimeAndDistance> |
getTimeAndDistanceList()
Returns a list of times and distances corresponding to each destination in the current route,
representing the estimated time and distance from the current position to each destination.
|
abstract List<LatLng> |
getTraveledRoute()
Returns the route traveled so far during this guidance session (since the last call to
startGuidance() ). |
abstract boolean |
isGuidanceRunning()
Returns
true if guidance is currently running. |
abstract boolean |
registerServiceForNavUpdates(String packageName, String serviceName, NavigationUpdatesOptions options)
Registers a service to receive navigation updates.
|
abstract boolean |
registerServiceForNavUpdates(String packageName, String serviceName, int numNextStepsToPreview)
Registers a service to receive navigation updates.
|
abstract void |
removeArrivalListener(Navigator.ArrivalListener listener)
Removes a listener added via
addArrivalListener(ArrivalListener) . |
abstract void |
removeNavigationSessionListener(Navigator.NavigationSessionListener listener)
Removes the listener added via
addNavigationSessionListener(NavigationSessionListener) . |
abstract void | |
abstract void |
removeReroutingListener(Navigator.ReroutingListener listener)
Removes the listener added via
addReroutingListener(ReroutingListener) . |
abstract void |
removeRouteChangedListener(Navigator.RouteChangedListener listener)
Removes the listener added via
addRouteChangedListener(RouteChangedListener) . |
abstract void |
removeTrafficUpdatedListener(Navigator.TrafficUpdatedListener listener)
Removes the listener added via
addTrafficUpdatedListener(TrafficUpdatedListener) . |
abstract void |
setAudioGuidance(int guidance)
Sets which types of audio guidance (including vibration) are enabled.
|
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestination(Waypoint destination, RoutingOptions routingOptions, DisplayOptions displayOptions)
Sets a single destination for navigation, overriding any previously set destinations.
|
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestination(Waypoint destination, RoutingOptions options)
Sets a single destination for navigation, overriding any previously set destinations.
|
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestination(Waypoint destination)
Sets a single destination for navigation, overriding any previously set destinations.
|
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestinations(List<Waypoint> destinations, RoutingOptions options)
Sets multiple destinations for navigation, overriding any previously set destinations.
|
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestinations(List<Waypoint> destinations, CustomRoutesOptions customRoutesOptions, DisplayOptions displayOptions)
Sets destinations for navigation using a route token to navigate on a precomputed route using
CustomRoutesOptions , overriding any previously set destinations. |
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestinations(List<Waypoint> destinations, RoutingOptions routingOptions, DisplayOptions displayOptions)
Sets multiple destinations for navigation, overriding any previously set destinations.
|
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestinations(List<Waypoint> destinations)
Sets multiple destinations for navigation, overriding any previously set destinations.
|
abstract ListenableResultFuture<Navigator.RouteStatus> |
setDestinations(List<Waypoint> destinations, CustomRoutesOptions customRoutesOptions)
Sets destinations for navigation using a route token to navigate on a precomputed route using
CustomRoutesOptions , overriding any previously set destinations. |
abstract void |
setHeadsUpNotificationEnabled(boolean enabled)
Sets whether heads-up notifications should be shown.
|
abstract void |
setLicensePlateRestrictionInfo(int rawLicensePlateLastDigit, String licensePlateCountryCode)
Sets license plate information about the current driver.
|
abstract void |
setSpeedAlertOptions(SpeedAlertOptions speedAlertOptions)
Sets
SpeedAlertOptions for customizing the triggering thresholds for SpeedAlertSeverity s. |
abstract void |
setSpeedingListener(SpeedingListener speedingListener)
Registers a
SpeedingListener for the percentage above the speed limit the driver is
currently driving at. |
abstract void |
setTaskRemovedBehavior(int taskRemovedBehavior)
Sets how the background service reacts when a user removes this app from their device's recent screen.
|
abstract void |
setTransactionIds(List<String> transactionIds)
Sets the ongoing transaction IDs.
|
abstract void |
startGuidance()
If a destination has been set and a route computed for it, starts turn-by-turn navigation
guidance for the route.
|
abstract void |
stopGuidance()
Stops turn-by-turn navigation guidance.
|
abstract boolean |
unregisterServiceForNavUpdates()
Unregisters the service that was previously registered via
registerServiceForNavUpdates(String, String, int) . |
Constants
public static final int MAX_NUM_TRANSACTION_IDS
public static final int MAX_TRANSACTION_ID_LENGTH
Public Methods
public abstract void addArrivalListener (Navigator.ArrivalListener listener)
Registers a listener for arrival events.
Note: In order to avoid memory leaks, use removeArrivalListener(ArrivalListener)
to
remove the listener that is no longer required.
Parameters
listener | the listener to register. Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void addNavigationSessionListener (Navigator.NavigationSessionListener listener)
Registers a listener for new navigation sessions.
Note: In order to avoid memory leaks, use removeNavigationSessionListener(NavigationSessionListener)
to remove the listener that is no
longer required.
Parameters
listener | the listener to register. Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void addRemainingTimeOrDistanceChangedListener (int timeChangeThresholdSeconds, int distanceChangeThresholdMeters, Navigator.RemainingTimeOrDistanceChangedListener listener)
Registers a listener for when the remaining time or distance to the destination changes by more than a specified threshold.
The listener could be called as a result of (for example) user movement, a change in traffic conditions OR a change in route OR a change in destination, or when the remaining time and distance first become known.
Note: In order to avoid memory leaks, use removeRemainingTimeOrDistanceChangedListener(RemainingTimeOrDistanceChangedListener)
to
remove the listener that is no longer required.
Note: Same listener instance can be added with different threshold values however, calling
removeRemainingTimeOrDistanceChangedListener(RemainingTimeOrDistanceChangedListener)
using that particular instance will remove it altogether.
Parameters
timeChangeThresholdSeconds | If the absolute change in the remaining time to destination in seconds is greater than or equal to this value, then the listener is called. This threshold must not be negative. |
---|---|
distanceChangeThresholdMeters | If the absolute change in the remaining distance in meters is greater than or equal to this value, then the listener is called. This threshold must not be negative. |
listener | the listener to register. Must not be null . |
Throws
IllegalArgumentException | if timeChangeThresholdSeconds is negative, or distanceChangeThresholdMeters is negative. |
---|---|
NullPointerException | if the listener is null .
|
public abstract void addReroutingListener (Navigator.ReroutingListener listener)
Registers a listener for route change that is requested in response to vehicle going off the suggested route.
Note: In order to avoid memory leaks, use removeReroutingListener(ReroutingListener)
to remove the listener that is no longer required.
Parameters
listener | the listener to register. Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void addRouteChangedListener (Navigator.RouteChangedListener listener)
Registers a listener for route changed events.
Note: In order to avoid memory leaks, use removeRouteChangedListener(RouteChangedListener)
to remove the listener that is no longer
required.
Parameters
listener | the listener to register. Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void addTrafficUpdatedListener (Navigator.TrafficUpdatedListener listener)
Registers a listener for traffic update events.
Note: In order to avoid memory leaks, use removeTrafficUpdatedListener(TrafficUpdatedListener)
to remove the listener that is no longer
required.
Parameters
listener | the listener to register. Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void cleanup ()
Cleans up internal state of the Navigator.
Invoke this method at the end of the user's session, usually in Activity or Fragment onDestroy()
(i.e. when you no longer need a Navigator).
Note: calling this method will cancel any pending requests to setDestinations(List
.
public abstract void clearDestinations ()
Clears all previously set destinations and removes any calculated routes from the map. If navigation is running, this will automatically stop it.
public abstract void clearLicensePlateRestrictionInfo ()
Clears license plate information about the current driver. This will only apply to setDestination calls made after this value is set.
public abstract Waypoint continueToNextDestination ()
Removes the current destination. Following this call, guidance will be toward the next destination, and information about the old destination is not available.
Returns
- the waypoint guidance is now heading to, or null if there were no more waypoints left
public abstract ListenableResultFuture<RouteInfo> fetchRouteInfo (Waypoint waypoint, RoutingOptions routingOptions)
This method is deprecated.
Prior to being deprecated, this method was only available to Mobility
Services customers. Please use the
Returns route information for routes based on each value of ERROR(/RoutingStrategy)
. ERROR(/RoutingStrategy)
is ignored since this method returns the route information for all routing
strategies.
Note: This is recalculated on every call and may not match the routes currently being used by navigation since traffic and other factors may have been updated in the interim.
Parameters
waypoint | the destination waypoint for the route |
---|---|
routingOptions | the options used to fetch the route info |
Returns
- the returned future
public abstract RouteSegment getCurrentRouteSegment ()
Returns the current segment of the journey. This RouteSegment
will have its starting
position as the most recent known (road-snapped) position of the device.
Returns
- a route segment object, or
null
if there is no current route
public abstract TimeAndDistance getCurrentTimeAndDistance ()
Returns the estimated time and distance from the current position to the current destination.
Returns
- a time and distance object, or
null
if there is no current route
public abstract List<RouteSegment> getRouteSegments ()
Returns a list of route segments. The destination of each returned segment will correspond to a destination set by setDestination(s).
public abstract List<TimeAndDistance> getTimeAndDistanceList ()
Returns a list of times and distances corresponding to each destination in the current route, representing the estimated time and distance from the current position to each destination.
public abstract List<LatLng> getTraveledRoute ()
Returns the route traveled so far during this guidance session (since the last call to startGuidance()
).
The route consists of road-snapped locations returned by the RoadSnappedLocationProvider
, and simplified to produce line segments.
Note: The system polls the client for GPS signals to obtain location data. Poor GPS signal can result in further interpolation, which might produce less precise routes.
public abstract boolean isGuidanceRunning ()
Returns true
if guidance is currently running. Note that guidance will only run once a
route to a destination has been computed and startGuidance()
has been called.
public abstract boolean registerServiceForNavUpdates (String packageName, String serviceName, NavigationUpdatesOptions options)
Registers a service to receive navigation updates. Navigation updates are sent to the service once per second.
The receiving service should have a Messenger
whose binder is exposed in
the Service.onBind(Intent)
method. Create a Handler
for the messenger to receive messages containing turn-by-turn navigation
information after the service is registered. Messages sent from the Navigation SDK have the
message code in Message.what
set to ERROR(/TurnByTurnManager#MSG_NAV_INFO)
.
The handler can then use ERROR(/TurnByTurnManager#readNavInfoFromBundle(Bundle bundle))
to get
the ERROR(/NavInfo)
from the message data, which can be retrieved from the message using ERROR(/Message#getData())
).
THIS API IS A PREVIEW RELEASE.
IT IS SUBJECT TO CHANGE AND BACKWARD COMPATIBILITY IS NOT GUARANTEED
Parameters
packageName | the name of the package where the service is defined. |
---|---|
serviceName | the name of the service. |
options | the options that will be used when reporting navigation updates to a registered service. |
Returns
true
if the service was successfully registered;false
if the service was not successfully registered or if there is already a service registered.
Throws
SecurityException | if the caller does not have permission to access the service or the service cannot be found. |
---|
public abstract boolean registerServiceForNavUpdates (String packageName, String serviceName, int numNextStepsToPreview)
Registers a service to receive navigation updates. Navigation updates will be sent to the service once per second.
The receiving service should have a Messenger
whose binder is exposed in
the Service.onBind(Intent)
method. Create a Handler
for the messenger to receive messages containing turn-by-turn navigation
information once the service is registered. Messages sent from the Navigation SDK have the
message code in Message.what
set to ERROR(/TurnByTurnManager#MSG_NAV_INFO)
.
The handler can then use ERROR(/TurnByTurnManager#readNavInfoFromBundle(Bundle bundle))
to get
the ERROR(/NavInfo)
from the message data, which can be retrieved from the message using ERROR(/Message#getData())
).
THIS API IS A BETA RELEASE.
IT IS SUBJECT TO CHANGE AND BACKWARDS COMPATIBILITY IS NOT GUARANTEED
Parameters
packageName | the name of the package where the service is defined. |
---|---|
serviceName | the name of the service. |
numNextStepsToPreview | the number of next nav steps in the route to be sent at each update if available, following the current step. |
Returns
true
if the service was successfully registered;false
if the service was not successfully registered or if there is already a service registered.
Throws
SecurityException | if the caller does not have permission to access the service or the service cannot be found. |
---|
public abstract void removeArrivalListener (Navigator.ArrivalListener listener)
Removes a listener added via addArrivalListener(ArrivalListener)
.
Parameters
listener | added via addArrivalListener(ArrivalListener) . Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void removeNavigationSessionListener (Navigator.NavigationSessionListener listener)
Removes the listener added via addNavigationSessionListener(NavigationSessionListener)
.
Parameters
listener | added via addNavigationSessionListener(NavigationSessionListener) .
Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void removeRemainingTimeOrDistanceChangedListener (Navigator.RemainingTimeOrDistanceChangedListener listener)
Removes the listener added via addRemainingTimeOrDistanceChangedListener(int, int, RemainingTimeOrDistanceChangedListener)
.
Parameters
listener | added via addRemainingTimeOrDistanceChangedListener(int, int, RemainingTimeOrDistanceChangedListener) . Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void removeReroutingListener (Navigator.ReroutingListener listener)
Removes the listener added via addReroutingListener(ReroutingListener)
.
Parameters
listener | added via addReroutingListener(ReroutingListener) . Must not be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void removeRouteChangedListener (Navigator.RouteChangedListener listener)
Removes the listener added via addRouteChangedListener(RouteChangedListener)
.
Parameters
listener | added via addRouteChangedListener(RouteChangedListener) . Must not be
null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void removeTrafficUpdatedListener (Navigator.TrafficUpdatedListener listener)
Removes the listener added via addTrafficUpdatedListener(TrafficUpdatedListener)
.
Parameters
listener | added via addTrafficUpdatedListener(TrafficUpdatedListener) . Must not
be null . |
---|
Throws
NullPointerException | if the listener is null .
|
---|
public abstract void setAudioGuidance (int guidance)
Sets which types of audio guidance (including vibration) are enabled. By default, vibration, voice, and voice over Bluetooth (if available) are enabled.
This method must be called on the UI thread.
Parameters
guidance | a combination of Navigator.AudioGuidance flags specifying which types of audio
guidance should be enabled |
---|
Throws
IllegalStateException | if it is not called from the UI thread |
---|
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestination (Waypoint destination, RoutingOptions routingOptions, DisplayOptions displayOptions)
Sets a single destination for navigation, overriding any previously set destinations. The
returned future will be set to Navigator.RouteStatus.OK
if a route is found from the user's
location to the given destination.
Parameters
destination | the new destination to be set |
---|---|
routingOptions | the options that will be used to generate the route |
displayOptions | the options that will be used to display the route |
Returns
- the returned future
Throws
NullPointerException | if the given destination is null |
---|
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestination (Waypoint destination, RoutingOptions options)
Sets a single destination for navigation, overriding any previously set destinations. The
returned future will be set to Navigator.RouteStatus.OK
if a route is found from the user's
location to the given destination. The default DisplayOptions
will be used to display
the route.
Parameters
destination | the new destination to be set |
---|---|
options | the options that will be used to generate the route |
Returns
- the returned future
Throws
NullPointerException | if the given destination is null |
---|
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestination (Waypoint destination)
Sets a single destination for navigation, overriding any previously set destinations. The
returned future will be set to Navigator.RouteStatus.OK
if a route is found from the user's
location to the given destination. The default RoutingOptions
will be used to find the
route, and the default DisplayOptions
will be used to display it.
Parameters
destination | the new destination to be set |
---|
Returns
- the returned future
Throws
NullPointerException | if the given destination is null |
---|
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestinations (List<Waypoint> destinations, RoutingOptions options)
Sets multiple destinations for navigation, overriding any previously set destinations. The
returned future will be set to Navigator.RouteStatus.OK
if a route is found from the user's
location to the given destination. The default DisplayOptions
will be used to display
the route.
Parameters
destinations | the new destination list to be set |
---|---|
options | the options that will be used to generate the route |
Returns
- the returned future
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestinations (List<Waypoint> destinations, CustomRoutesOptions customRoutesOptions, DisplayOptions displayOptions)
Sets destinations for navigation using a route token to navigate on a precomputed route using
CustomRoutesOptions
, overriding any previously set destinations. Routes will be the
same, modulo changes to the driver starting location and to road/traffic conditions.
The returned future will be set to Navigator.RouteStatus.OK
if a route is found from the
user's location to the given destination.
Parameters
destinations | the new destination list to be set. |
---|---|
customRoutesOptions | the options that will be used to retrieve a precomputed route, based on a token returned by the Routes Preferred API. |
displayOptions | the options that will be used to display the route. |
Returns
- a future object with the status of the request.
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestinations (List<Waypoint> destinations, RoutingOptions routingOptions, DisplayOptions displayOptions)
Sets multiple destinations for navigation, overriding any previously set destinations. The
returned future will be set to Navigator.RouteStatus.OK
if a route is found from the user's
location to the given destination.
Parameters
destinations | the new destination list to be set |
---|---|
routingOptions | the options that will be used to generate the route |
displayOptions | the options that will be used to display the route |
Returns
- the returned future
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestinations (List<Waypoint> destinations)
Sets multiple destinations for navigation, overriding any previously set destinations. The
returned future will be set to Navigator.RouteStatus.OK
if a route is found from the user's
location to the given destination. The default RoutingOptions
will be used to find the
route, and the default DisplayOptions
will be used to display it.
Parameters
destinations | the new destination list to be set |
---|
Returns
- the returned future
public abstract ListenableResultFuture<Navigator.RouteStatus> setDestinations (List<Waypoint> destinations, CustomRoutesOptions customRoutesOptions)
Sets destinations for navigation using a route token to navigate on a precomputed route using
CustomRoutesOptions
, overriding any previously set destinations. Routes will be the
same, modulo changes to the driver starting location and to road/traffic conditions.
The returned future will be set to Navigator.RouteStatus.OK
if a route is found from the
user's location to the given destination.
The default DisplayOptions
will be used to display the route.
Parameters
destinations | the new destination list to be set. |
---|---|
customRoutesOptions | the options that will be used to retrieve a precomputed route, based on a token returned by the Routes Preferred API. |
Returns
- a future object with the status of the request.
public abstract void setHeadsUpNotificationEnabled (boolean enabled)
Sets whether heads-up notifications should be shown. By default, the notification is enabled. Heads-up events are guidance events such as turns, etc, that are displayed when there is no map visible.
This method must be called on the UI thread.
Parameters
enabled | a flag to indicate if heads-up notifications should be enabled |
---|
Throws
IllegalStateException | if it is not called from the UI thread |
---|
public abstract void setLicensePlateRestrictionInfo (int rawLicensePlateLastDigit, String licensePlateCountryCode)
Sets license plate information about the current driver. This allows us to route around certain types of road restrictions which are based on license plate number. This will only apply to setDestination calls made after this value is set. Ideally you'd call this immediately after getting the navigator.
Parameters
rawLicensePlateLastDigit | The last digit of the license plate (must be between 0 and 9). |
---|---|
licensePlateCountryCode | Currently we support Indonesia (ID) and Brazil (BZ) others may be supported in the future and you are free to proactively provide this information. |
public abstract void setSpeedAlertOptions (SpeedAlertOptions speedAlertOptions)
Sets SpeedAlertOptions
for customizing the triggering thresholds for SpeedAlertSeverity
s.
You can use this method to customize the speed alert triggering thresholds in percentage for
both SpeedAlertSeverity.MINOR
and SpeedAlertSeverity.MAJOR
alerts. You can also
use this method to configure the time in seconds needed to upgrade speed alerts from SpeedAlertSeverity.MINOR
to SpeedAlertSeverity.MAJOR
.
By setting a null
SpeedAlertOptions
or not setting any, you won't receive
any speeding feed data, and the NavSDK's default speed alert will display: speed alert shows
red text in white/dark background for day/night mode respectively when the speed is less than 5
mph or 10 kph over the speed limit, and shows white text in red background when speeding more
than 5 mph or 10 kph.
The triggering thresholds configured in SpeedAlertOptions
are used to decide whether
to display minor or major alerts.
Parameters
speedAlertOptions |
---|
public abstract void setSpeedingListener (SpeedingListener speedingListener)
Registers a SpeedingListener
for the percentage above the speed limit the driver is
currently driving at.
By setting a null
SpeedingListener
or not setting any, you won't receive any
speeding feed data.
Parameters
speedingListener |
---|
public abstract void setTaskRemovedBehavior (int taskRemovedBehavior)
Sets how the background service reacts when a user removes this app from their device's recent screen. This impacts location updates, continued navigation/guidance, and the associated notification.
By default, the service, guidance, and notification will continue to perform after the
app/task is removed, equivalent to Navigator.TaskRemovedBehavior.CONTINUE_SERVICE
.
Parameters
taskRemovedBehavior | The TaskRemovedBehavior value for desired behavior. |
---|
public abstract void setTransactionIds (List<String> transactionIds)
Sets the ongoing transaction IDs. This API should be used when a new navigation session starts
(in the Navigator.NavigationSessionListener.onNewNavigationSession()
) and when the transaction IDs
change in an ongoing navigation session (e.g. when the list of journey segments is updated).
The transactionIds parameter should be populated with unique string identifiers for one or more transactions that apply to the following events during the current navigation.
This will overwrite any transaction IDs set before.
Transaction IDs will be cleared at the end of the navigation session.
Each transaction ID must be at least 1 and at most 64 characters long, and there is a maximum of 100 transaction IDs per call.
This method should only be used by Mobility Services customers.
Parameters
transactionIds | one or more transaction IDs to which the following navigation applies. A transaction ID is an arbitrary string that is unique for each billable transaction. |
---|
Throws
NavigationTransactionRecorder.TransactionException | occurs for the following issues with transaction IDs: null
transaction IDs, greater than MAX_NUM_TRANSACTION_IDS of transaction IDs,
or transactions IDs longer than MAX_TRANSACTION_ID_LENGTH .
|
---|
public abstract void startGuidance ()
If a destination has been set and a route computed for it, starts turn-by-turn navigation guidance for the route. If a route has not yet been computed, turn-by-turn guidance will start once it has.
You must explicitly call stopGuidance() to stop the navigation service. The navigation service will not automatically stop upon arrival. If you want to stop the navigation service upon arrival, you need to call stopGuidance() in the NavArrivalListener.
Note: this method does not change the position of the camera.
public abstract void stopGuidance ()
Stops turn-by-turn navigation guidance.
public abstract boolean unregisterServiceForNavUpdates ()
Unregisters the service that was previously registered via registerServiceForNavUpdates(String, String, int)
.
THIS API IS A BETA RELEASE.
IT IS SUBJECT TO CHANGE AND BACKWARDS COMPATIBILITY IS NOT GUARANTEED
Returns
true
if the service was successfully unregistered;false
if the service was not successfully unregistered or if there is not a previously registered service.