public class DemandClient extends Object implements INetworkClient
Modifier and Type | Class and Description |
---|---|
static interface |
DemandClient.RideUpdateListener
The listener interface to be implemented by the caller, to get notifications about
Ride updates. |
Modifier | Constructor and Description |
---|---|
protected |
DemandClient(com.here.mobility.sdk.demand.C2SDemandClient c2sDemandClient,
com.here.mobility.sdk.demand.RideStatusPoller statusPoller,
com.here.mobility.sdk.demand.VerifiedDemandClient verifiedDemandClient)
Generate new demand Client.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelAllActiveRequests()
Cancels all active requests this client has running.
|
ResponseFuture<CancellationInfo> |
cancelRide(CancelRideRequest cancelRideRequest)
Cancels the given ride.
|
ResponseFuture<CancellationInfo> |
cancelRide(String rideId,
String reason)
Deprecated.
This field is deprecated, please use
DemandClient.cancelRide(CancelRideRequest) instead.
This request can throw the following exceptions:
HMAuthException |
ResponseFuture<Ride> |
createRide(CreateRideRequest request)
Create a new ride.
|
ResponseFuture<Ride> |
getRide(String rideId)
Get a ride's details.
|
ResponseFuture<List<RideOffer>> |
getRideOffers(RideOffersRequest request)
Get ride offers from multiple suppliers.
|
ResponseFuture<RidePayment> |
getRidePayment(String rideId)
Get payment details of the given ride.
|
ResponseFuture<RideQueryResponse> |
getRides(RideQuery query)
Query for rides of the current user.
|
ResponseFuture<VerticalsCoverageResponse> |
getVerticalsCoverage(VerticalsCoverageRequest verticalsCoverageRequest)
Get the verticals (transit types) coverage available around a specific location.
|
static DemandClient |
newInstance()
Returns a new
DemandClient . |
static DemandClient |
newInstance(Context context)
Deprecated.
Use
DemandClient.newInstance() instead. |
ResponseFuture<Void> |
registerToRideUpdates(DemandClient.RideUpdateListener listener)
Register for ride updates.
|
ResponseFuture<Void> |
registerToRideUpdates(DemandClient.RideUpdateListener listener,
Handler handler)
Register for ride updates.
|
ResponseFuture<Void> |
registerToRideUpdates(String rideId,
DemandClient.RideUpdateListener listener)
Register for updates of the ride with the given ID.
|
ResponseFuture<Void> |
registerToRideUpdates(String rideId,
DemandClient.RideUpdateListener listener,
Handler handler)
Register for updates of the ride with the given ID.
|
void |
shutdown()
Shuts down this
INetworkClient . |
void |
shutdownNow()
Shuts down this
INetworkClient immediately, forcefully closing even preexisting calls. |
void |
unregisterFromRideUpdates(DemandClient.RideUpdateListener listener)
Unregister from ride updates.
|
protected DemandClient(com.here.mobility.sdk.demand.C2SDemandClient c2sDemandClient, com.here.mobility.sdk.demand.RideStatusPoller statusPoller, com.here.mobility.sdk.demand.VerifiedDemandClient verifiedDemandClient)
public static DemandClient newInstance()
DemandClient
.@Deprecated public static DemandClient newInstance(Context context)
DemandClient.newInstance()
instead.DemandClient
.public ResponseFuture<List<RideOffer>> getRideOffers(RideOffersRequest request)
HMDemandInternalException
HMDemandPickupTimeTooFarAheadException
HMDemandPickupTimeInThePastException
HMDemandMaximumWalkingDistanceNotSupportedException
HMDemandInvalidNumberOfChangesException
HMAuthException
except HMAuthPhoneNotVerifiedException
public ResponseFuture<Ride> createRide(CreateRideRequest request)
HMDemandInternalException
HMDemandOfferExpiredException
HMDemandMissingPaymentIdForOnlineOfferException
HMDemandPaymentIdProvidedForOfflineOfferException
public ResponseFuture<RideQueryResponse> getRides(RideQuery query)
HMDemandInternalException
HMAuthException
public ResponseFuture<Ride> getRide(String rideId)
rideId
- ID of the requested rideRide
object
This request can throw the following exceptions:
HMDemandInternalException
HMDemandRideNotFoundException
HMAuthException
public ResponseFuture<VerticalsCoverageResponse> getVerticalsCoverage(VerticalsCoverageRequest verticalsCoverageRequest)
verticalsCoverageRequest
- the verticals coverage requestVerticalsCoverageResponse
the response, contains a list of all available RideOffer.TransitType
around the given location
This request can throw the following exceptions:
HMDemandInternalException
HMAuthException
except HMAuthPhoneNotVerifiedException
@Deprecated public ResponseFuture<CancellationInfo> cancelRide(String rideId, String reason)
DemandClient.cancelRide(CancelRideRequest)
instead.
This request can throw the following exceptions:
HMAuthException
rideId
- the ride to cancelreason
- Why the ride is cancelledpublic ResponseFuture<CancellationInfo> cancelRide(CancelRideRequest cancelRideRequest)
cancelRideRequest
- the ride request to cancel.HMDemandRideNotFoundException
HMAuthException
public ResponseFuture<RidePayment> getRidePayment(String rideId)
rideId
- the ride to get payment details for
This request can throw the following exceptions:
HMDemandInternalException
HMAuthException
public ResponseFuture<Void> registerToRideUpdates(DemandClient.RideUpdateListener listener)
listener
- DemandClient.RideUpdateListener
to be called on updatesHMAuthException
public ResponseFuture<Void> registerToRideUpdates(DemandClient.RideUpdateListener listener, Handler handler)
listener
- DemandClient.RideUpdateListener
to be called on updateshandler
- The handler on which to call the listener.HMAuthException
public ResponseFuture<Void> registerToRideUpdates(String rideId, DemandClient.RideUpdateListener listener)
rideId
- ID of the ride in whose updates you're interestedlistener
- DemandClient.RideUpdateListener
to be called on updatesHMAuthException
public ResponseFuture<Void> registerToRideUpdates(String rideId, DemandClient.RideUpdateListener listener, Handler handler)
rideId
- The ID of the ride in whose updates you're interestedlistener
- DemandClient.RideUpdateListener
to be called on updateshandler
- the handler on which to call the listenerHMAuthException
public void unregisterFromRideUpdates(DemandClient.RideUpdateListener listener)
listener
- DemandClient.RideUpdateListener
to unregister.public void cancelAllActiveRequests()
INetworkClient
cancelAllActiveRequests
in interface INetworkClient
public void shutdown()
INetworkClient
INetworkClient
. All active requests are cancelled, and the underlying
channel is shutdown cleanly (requests in progress will finish, but no new ones will be
accepted).
Note that any streaming requests may continue indefinitely.shutdown
in interface INetworkClient
public void shutdownNow()
INetworkClient
INetworkClient
immediately, forcefully closing even preexisting calls.
This is the preferred method to call when using INetworkClient
from an Android activity
or service that is finishing, because it should guarantee that no further callbacks will be
invoked.shutdownNow
in interface INetworkClient