Package es.situm.sdk.navigation
Interface NavigationManager
-
public interface NavigationManagerCentral point to update the progress of a user when follows a route
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddNavigationListener(NavigationListener listener)Adds aNavigationListenerthat will receive the navigation events.booleanisRunning()Returns true if the navigation is running, false otherwisevoidremoveAllNavigationListeners()If any, removes all theNavigationListeners previously subscribed.voidremoveNavigationListener(NavigationListener listener)Removes the givenNavigationListener.booleanremoveUpdates()Removes all location updates.voidrequestNavigationUpdates(NavigationRequest request)Request navigation updates using the givenNavigationRequest.voidrequestNavigationUpdates(NavigationRequest navigationRequest, DirectionsRequest directionsRequest, Handler<Route> callback)Request navigation updates.voidrequestNavigationUpdates(NavigationRequest request, NavigationListener listener)Request navigation updates using the givenNavigationRequestand sets the listener that receives the updated navigation progress.voidupdateNavigationState(ExternalNavigation externalNavigation)For internal use onlybooleanupdateWithLocation(Location location)InformsNavigationManagerobject the change of the user's location
-
-
-
Method Detail
-
requestNavigationUpdates
void requestNavigationUpdates(@NonNull NavigationRequest request) throws java.lang.IllegalArgumentExceptionRequest navigation updates using the givenNavigationRequest. Can only exist one navigation at a time. If this method was previously invoked andremoveUpdates()wasn't,removeUpdates()will be called internally.- Parameters:
request-NavigationRequestwith navigation params.NavigationRequest.getRoute()can't be null, andNavigationRequest.getDistanceToGoalThreshold()andNavigationRequest.getOutsideRouteThreshold()must be greater than 0.- Throws:
java.lang.IllegalArgumentException- ifrequestorNavigationRequest.getRoute()are null, or ifNavigationRequest.getDistanceToGoalThreshold()orNavigationRequest.getOutsideRouteThreshold()have 0 or negative value.
-
addNavigationListener
void addNavigationListener(@NonNull NavigationListener listener) throws java.lang.IllegalArgumentExceptionAdds aNavigationListenerthat will receive the navigation events.- Parameters:
listener- TheNavigationListener.- Throws:
java.lang.IllegalArgumentException
-
removeNavigationListener
void removeNavigationListener(@NonNull NavigationListener listener) throws java.lang.IllegalArgumentExceptionRemoves the givenNavigationListener.- Parameters:
listener- TheNavigationListenerthat will be removed.- Throws:
java.lang.IllegalArgumentException- iflisteneris null.
-
removeAllNavigationListeners
void removeAllNavigationListeners()
If any, removes all theNavigationListeners previously subscribed.
-
requestNavigationUpdates
void requestNavigationUpdates(@NonNull NavigationRequest request, @NonNull NavigationListener listener) throws java.lang.IllegalArgumentExceptionRequest navigation updates using the givenNavigationRequestand sets the listener that receives the updated navigation progress.Removes all the
Can only exist one navigation with one listener at a time. If this method was previously invoked andLocationListeners previously provided.removeUpdates()wasn't,removeUpdates()will be called internally.- Parameters:
request-NavigationRequestwith navigation params.NavigationRequest.getRoute()can't be null, andNavigationRequest.getDistanceToGoalThreshold()andNavigationRequest.getOutsideRouteThreshold()must be greater than 0.listener-NavigationListenerthat receives updates of navigation progress.- Throws:
java.lang.IllegalArgumentException- iflistener,requestorNavigationRequest.getRoute()are null, or ifNavigationRequest.getDistanceToGoalThreshold()orNavigationRequest.getOutsideRouteThreshold()have 0 or negative value.
-
requestNavigationUpdates
void requestNavigationUpdates(@NonNull NavigationRequest navigationRequest, @NonNull DirectionsRequest directionsRequest, @NonNull Handler<Route> callback) throws java.lang.IllegalArgumentExceptionRequest navigation updates. This is an overload ofrequestNavigationUpdates(NavigationRequest)that calculates the route for you and automatically starts navigation when the route is obtained. To calculate the route you will need to provide theDirectionsRequest. As it is evident, you don't need to pass aRouteinto the givenNavigationRequest. Using this method the SDK will automatically callupdateWithLocation(Location)every time the location is updated, so you don't need to do it by your side.- Parameters:
navigationRequest-NavigationRequestwith navigation params.directionsRequest-DirectionsRequestwith directions params.callback-Handlerthat will receive the success or failure callbacks on the route calculation.- Throws:
java.lang.IllegalArgumentException- ifnavigationRequest,directionsRequestorcallbackare null, or ifNavigationRequest.getDistanceToGoalThreshold()orNavigationRequest.getOutsideRouteThreshold()have 0 or negative value.
-
updateWithLocation
boolean updateWithLocation(@NonNull Location location)InformsNavigationManagerobject the change of the user's location- Parameters:
location- newLocationof the user. If null, nothing is done- Returns:
- true if there is a listener to which notify progress update. False if there isn't, so this method do nothing.
-
removeUpdates
boolean removeUpdates()
Removes all location updates. This removes the internal state of the manager, including the listener provided inrequestNavigationUpdates(NavigationRequest, NavigationListener), so it won't receive more progress updates.- Returns:
- true if a listener was removed. False if there was no listener.
-
isRunning
boolean isRunning()
Returns true if the navigation is running, false otherwise
-
updateNavigationState
void updateNavigationState(ExternalNavigation externalNavigation)
For internal use only
-
-