public interface NavigationManager
Modifier and Type | Interface and Description |
---|---|
static class |
NavigationManager.Builder |
static class |
NavigationManager.NavigationState
Enum representation of the states the navigation manager can be in.
|
Modifier and Type | Method and Description |
---|---|
void |
addAndNotifyNavigationStateListener(NavigationStateListener listener) |
void |
addAndNotifyProgressListener(NavigationProgressListener listener) |
void |
addAndNotifySpeedLimitSpanListener(SpeedLimitSpanListener listener) |
void |
addEtaResponseListener(EtaResponseListener etaResponseListener) |
void |
addNavigationStateListener(NavigationStateListener listener) |
void |
addProgressListener(NavigationProgressListener listener) |
void |
addPromptListener(PromptListener listener) |
void |
addRerouteListener(RerouteListener 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.
|
NavigationManager.NavigationState |
getNavigationState() |
Route |
getRoute()
Gets the route being currently navigated.
|
UserLocationTrackingConsentStatus |
getUserLocationTrackingConsentStatus() |
void |
initialize()
Called to initialize the NavigationManager, to perform any internal initialization needed.
|
void |
pauseNavigation()
Pauses the current navigation session.
|
boolean |
removeEtaResponseListener(EtaResponseListener etaResponseListener) |
boolean |
removeNavigationStateListener(NavigationStateListener listener) |
boolean |
removeProgressListener(NavigationProgressListener listener) |
boolean |
removePromptListener(PromptListener listener) |
void |
removeRerouteListener(RerouteListener listener) |
boolean |
removeSpeedLimitSpanListener(SpeedLimitSpanListener listener) |
boolean |
removeTrafficResponseListener(TrafficResponseListener listener) |
void |
resumeNavigation()
Resumes the current navigation session.
|
void |
setRerouteBehaviorOverride(RerouteBehaviorOverride rerouteBehaviorOverride)
Sets a RerouteBehaviorOverride 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 NavigationStateListener.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
NavigationStateListener.onNavigationStopped(RouteStoppedReason)
will be called
with a reason of RouteStoppedReason.ROUTE_CANCELED
.
NavigationManager.NavigationState getNavigationState()
NavigationManager.NavigationState
this instance is in.Route getRoute()
Route
being navigated, or null if no route is active.RouteLeg getCurrentRouteLeg()
void advanceRouteToNextLeg()
void addNavigationStateListener(NavigationStateListener listener)
void addAndNotifyNavigationStateListener(NavigationStateListener listener)
boolean removeNavigationStateListener(NavigationStateListener listener)
void addProgressListener(NavigationProgressListener listener)
void addAndNotifyProgressListener(NavigationProgressListener listener)
boolean removeProgressListener(NavigationProgressListener listener)
void addRerouteListener(RerouteListener listener)
void removeRerouteListener(RerouteListener 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 Google Fuze provider, named GoogleLocationProviderAdapter -- please refer to the documentation for more details on the LocationProviderAdapter and the implementation of the example GoogleLocationProviderAdapter.
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 setRerouteBehaviorOverride(RerouteBehaviorOverride rerouteBehaviorOverride)
RerouteBehaviorOverride.shouldReroute(Coordinate)
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.rerouteBehaviorOverride
- - an implementation of that indicates whether or not to automatically re-route navigation when user
goes off-route. Specify null to fall-back to the default strategy -- which will always automatically re-route.