public interface NavigationManager
Modifier and Type | Interface and Description |
---|---|
static class |
NavigationManager.Builder |
Modifier and Type | Method and Description |
---|---|
void |
addAndNotifyNavigationStartStopListener(NavigationStartStopListener listener) |
void |
addAndNotifyProgressListener(NavigationProgressListener listener) |
void |
addAndNotifySpeedLimitSpanListener(SpeedLimitSpanListener listener) |
void |
addEtaResponseListener(EtaResponseListener etaResponseListener) |
void |
addNavigationStartStopListener(NavigationStartStopListener listener) |
void |
addProgressListener(NavigationProgressListener listener) |
void |
addPromptListener(PromptListener listener) |
void |
addRouteResponseListener(RouteResponseListener listener) |
void |
addSpeedLimitSpanListener(SpeedLimitSpanListener listener) |
void |
addTrafficResponseListener(TrafficResponseListener listener) |
void |
advanceRouteToNextLeg()
Advances navigation to the next route-leg of the current route.
|
void |
cancelNavigation()
Cancels the current navigation session.
|
void |
deinitialize()
Called to de-initialize the NavigationManager, to perform any internal shutdown steps needed.
|
RouteLeg |
getCurrentRouteLeg()
Gets the current route-leg of the route being navigated.
|
LocationProviderAdapter |
getLocationProviderAdapter()
Gets the current location-provider adapter that supplies location updates during navigation.
|
Route |
getRoute()
Gets the route being currently navigated.
|
UserLocationTrackingConsentStatus |
getUserLocationTrackingConsentStatus() |
void |
initialize()
Called to initialize the NavigationManager, to perform any internal initialization needed.
|
boolean |
isPaused() |
boolean |
isReroutingOn() |
boolean |
isStopped() |
void |
pauseNavigation()
Pauses the current navigation session.
|
boolean |
removeEtaResponseListener(EtaResponseListener etaResponseListener) |
boolean |
removeNavigationStartStopListener(NavigationStartStopListener listener) |
boolean |
removeProgressListener(NavigationProgressListener listener) |
boolean |
removePromptListener(PromptListener listener) |
boolean |
removeRouteResponseListener(RouteResponseListener listener) |
boolean |
removeSpeedLimitSpanListener(SpeedLimitSpanListener listener) |
boolean |
removeTrafficResponseListener(TrafficResponseListener listener) |
void |
resumeNavigation()
Resumes the current navigation session.
|
void |
setReroutePreferenceIndicator(ReroutePreferenceIndicator reroutePreferenceIndicator)
Sets a ReroutePreferenceIndicator that can be used to dynamically indicate whether the navigation should reroute.
|
void |
setUserLocationTrackingConsentStatus(UserLocationTrackingConsentStatus userLocationTrackingConsentStatus)
Users must be prompted to provide consent for location tracking.
|
void |
startNavigation(Route route)
Starts navigation along the supplied route.
|
void initialize()
startNavigation(Route)
or any other method.void deinitialize()
void startNavigation(Route route)
Once navigation has started, the listener method NavigationStartStopListener.onNavigationStarted()
is called.
Note that if the Route
started cannot be navigated directly, given the user's current location,
the NavigationManager will automatically perform a "re-route" request using the the RouteService
-- and as a result of this action, will notify any listeners of the new route received by calling
RouteResponseListener.onRouteRetrieved(Route)
. The NavigationManager will then continue navigation using this new route.
route
- the route to navigate.java.lang.IllegalStateException
- if setUserLocationTrackingConsentStatus(UserLocationTrackingConsentStatus)
is not set to either the GRANTED or DENIED state.java.lang.IllegalArgumentException
- if route is nullvoid pauseNavigation()
To resume navigating, call resumeNavigation()
.
void resumeNavigation()
This method resumes navigation after a call to pauseNavigation()
.
void cancelNavigation()
Note that once the navigation session has been canceled, the listener method
NavigationStartStopListener.onNavigationStopped(RouteStoppedReason)
will be called
with a reason of RouteStoppedReason.ROUTE_CANCELED
.
boolean isStopped()
Note that if a NavigationStartStopListener
has been defined, when navigation stops
the listener method NavigationStartStopListener.onNavigationStopped(RouteStoppedReason)
is called
with an argument specifying the RouteStoppedReason
.
boolean isPaused()
boolean isReroutingOn()
Route getRoute()
Route
being navigated, or null if no route is active.RouteLeg getCurrentRouteLeg()
void advanceRouteToNextLeg()
void addNavigationStartStopListener(NavigationStartStopListener listener)
void addAndNotifyNavigationStartStopListener(NavigationStartStopListener listener)
boolean removeNavigationStartStopListener(NavigationStartStopListener listener)
void addProgressListener(NavigationProgressListener listener)
void addAndNotifyProgressListener(NavigationProgressListener listener)
boolean removeProgressListener(NavigationProgressListener listener)
void addRouteResponseListener(RouteResponseListener listener)
boolean removeRouteResponseListener(RouteResponseListener listener)
void addTrafficResponseListener(TrafficResponseListener listener)
boolean removeTrafficResponseListener(TrafficResponseListener listener)
void addSpeedLimitSpanListener(SpeedLimitSpanListener listener)
void addAndNotifySpeedLimitSpanListener(SpeedLimitSpanListener listener)
boolean removeSpeedLimitSpanListener(SpeedLimitSpanListener listener)
void addPromptListener(PromptListener listener)
boolean removePromptListener(PromptListener listener)
void addEtaResponseListener(EtaResponseListener etaResponseListener)
boolean removeEtaResponseListener(EtaResponseListener etaResponseListener)
LocationProviderAdapter getLocationProviderAdapter()
When navigating a Route
using the NavigationManager, the user's location updates are provided to the SDK
by a location provider. The abstract class LocationProviderAdapter
in the SDK provides a generic "wrapper" for any
location-provider of your choice -- for example, a native Google location service, a "mocked" location-provider
(e.g. used during testing), or one of the commonly used 3rd-party location libraries such as
Mapzen Lost.
The Navigation SDK Reference Sample Application provides an example implementation using the Mapzen Lost location provider library, named MapzenLocationProviderAdapter -- please refer to the documentation for more details on the LocationProviderAdapter and the implementation of the example MapzenLocationProviderAdapter.
LocationProviderAdapter
being used.UserLocationTrackingConsentStatus getUserLocationTrackingConsentStatus()
void setUserLocationTrackingConsentStatus(UserLocationTrackingConsentStatus userLocationTrackingConsentStatus)
UserLocationTrackingConsentStatus
of either
GRANTED or DENIED must be set before navigation can start otherwise startNavigation(Route)
will throw an
IllegalStateException.void setReroutePreferenceIndicator(ReroutePreferenceIndicator reroutePreferenceIndicator)
ReroutePreferenceIndicator.shouldReroute()
return false. The host app could decide to toggle reroutes
back on when it determines that its current off-route location is closer to the destination and a new route is warranted.reroutePreferenceIndicator
- - an implementation of ReroutePreferenceIndicator that indicates whether to reroute. Can
pass in null to fall back to the default strategy of always rerouting.