Package es.situm.sdk.navigation
Interface NavigationManager
-
public interface NavigationManager
Central 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 void
addNavigationListener(NavigationListener listener)
Adds aNavigationListener
that will receive the navigation events.boolean
isRunning()
Returns true if the navigation is running, false otherwisevoid
removeAllNavigationListeners()
If any, removes all theNavigationListener
s previously subscribed.void
removeNavigationListener(NavigationListener listener)
Removes the givenNavigationListener
.boolean
removeUpdates()
Removes all location updates.void
requestNavigationUpdates(NavigationRequest request)
Request navigation updates using the givenNavigationRequest
.void
requestNavigationUpdates(NavigationRequest navigationRequest, DirectionsRequest directionsRequest, Handler<Route> callback)
Request navigation updates.void
requestNavigationUpdates(NavigationRequest request, NavigationListener listener)
Request navigation updates using the givenNavigationRequest
and sets the listener that receives the updated navigation progress.void
updateNavigationState(ExternalNavigation externalNavigation)
For internal use onlyboolean
updateWithLocation(Location location)
InformsNavigationManager
object the change of the user's location
-
-
-
Method Detail
-
requestNavigationUpdates
void requestNavigationUpdates(@NonNull NavigationRequest request) throws java.lang.IllegalArgumentException
Request 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
-NavigationRequest
with navigation params.NavigationRequest.getRoute()
can't be null, andNavigationRequest.getDistanceToGoalThreshold()
andNavigationRequest.getOutsideRouteThreshold()
must be greater than 0.- Throws:
java.lang.IllegalArgumentException
- ifrequest
orNavigationRequest.getRoute()
are null, or ifNavigationRequest.getDistanceToGoalThreshold()
orNavigationRequest.getOutsideRouteThreshold()
have 0 or negative value.
-
addNavigationListener
void addNavigationListener(@NonNull NavigationListener listener) throws java.lang.IllegalArgumentException
Adds aNavigationListener
that will receive the navigation events.- Parameters:
listener
- TheNavigationListener
.- Throws:
java.lang.IllegalArgumentException
-
removeNavigationListener
void removeNavigationListener(@NonNull NavigationListener listener) throws java.lang.IllegalArgumentException
Removes the givenNavigationListener
.- Parameters:
listener
- TheNavigationListener
that will be removed.- Throws:
java.lang.IllegalArgumentException
- iflistener
is null.
-
removeAllNavigationListeners
void removeAllNavigationListeners()
If any, removes all theNavigationListener
s previously subscribed.
-
requestNavigationUpdates
void requestNavigationUpdates(@NonNull NavigationRequest request, @NonNull NavigationListener listener) throws java.lang.IllegalArgumentException
Request navigation updates using the givenNavigationRequest
and 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 andLocationListener
s previously provided.removeUpdates()
wasn't,removeUpdates()
will be called internally.- Parameters:
request
-NavigationRequest
with navigation params.NavigationRequest.getRoute()
can't be null, andNavigationRequest.getDistanceToGoalThreshold()
andNavigationRequest.getOutsideRouteThreshold()
must be greater than 0.listener
-NavigationListener
that receives updates of navigation progress.- Throws:
java.lang.IllegalArgumentException
- iflistener
,request
orNavigationRequest.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.IllegalArgumentException
Request 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 aRoute
into 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
-NavigationRequest
with navigation params.directionsRequest
-DirectionsRequest
with directions params.callback
-Handler
that will receive the success or failure callbacks on the route calculation.- Throws:
java.lang.IllegalArgumentException
- ifnavigationRequest
,directionsRequest
orcallback
are null, or ifNavigationRequest.getDistanceToGoalThreshold()
orNavigationRequest.getOutsideRouteThreshold()
have 0 or negative value.
-
updateWithLocation
boolean updateWithLocation(@NonNull Location location)
InformsNavigationManager
object the change of the user's location- Parameters:
location
- newLocation
of 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
-
-