Manage Driver Availability

Introduction

In the gig-worker world, drivers can become available or unavailable for work at any time of the day. This requires you to react as they change their status so you can track their location and assign relevant nearby orders. When drivers are made available, HyperTrack will intelligently collect their location data so you can assign on-demand orders to the nearst drivers and reduce fulfillment times. The HyperTrack SDK makes this very easy to support as described below.

Make drivers available

The code below shows how to make your drivers available when they are ready to accept orders in the HyperTrack SDK:

HyperTrack.isAvailable = true
HyperTrack.setIsAvailable(true)

Important: When your drivers indicate they are no longer available for work, you can change their status to 'unavailable' in the SDK as described in the next section.

Make drivers unavailable

When your driver indicates they no longer ready to accept orders like when they are ending their shift you can make them unavailable as shown below:

HyperTrack.isAvailable = false
HyperTrack.setIsAvailable(false)

Subscribe to driver availability changes

The driver availability can be changes both from SDK API on device and HyperTrack server API. You can subscribe to the availability status changes on device as shown below:

HyperTrack.subscribeToIsAvailable { isAvailable -> 
  ...
}
HyperTrack.subscribeToIsAvailable { isAvailable in
  ...
}
HyperTrack.subscribeToIsAvailable(isAvailable -> {
  ...
  return null;
});
HyperTrack.subscribeToIsAvailable((isAvailable: boolean) => {
	...
});
HyperTrack.subscribeToIsAvailable(function (isAvailable) {
	...
})