Manage Worker Availability

Introduction

Workers 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 workers are made available, HyperTrack will intelligently collect their location data so you can assign on-demand orders to the nearst workers and reduce fulfillment times. The HyperTrack SDK makes this very easy to support as described below.

Make workers available

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

HyperTrack.isAvailable = true
HyperTrack.setIsAvailable(true)

Important: When your workers 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 workers unavailable

When your worker 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 worker availability changes

The worker 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) {
	...
})