7.7.0
Added
- Support for on-device geofencing via new
HyperTrack.orders["my_order"].isInsideGeofence
property- To learn more about how to best use this new feature see our guide here: https://developer.hypertrack.com/docs/clock-in-out-tagging#verify-shift-presence-before-starting-work
Example use for worker clock in:
fun handlePresence(isInsideResult: Result<Boolean, HyperTrackLocationError>) {
when (isInsideResult) {
is Result.Success -> {
val isInside = isInsideResult.getOrNull() ?: false
if (isInside) {
// allow worker to clock in for the shift
} else {
// "to clock in you must be at order destination"
}
}
is Result.Failure -> {
// resolve any tracking errors to obtain geofence presence
}
}
}
// Check if a worker is inside an order's geofence
handlePresence(HyperTrack.orders["my_order"]?.isInsideGeofence)
// Or, listen to order.isInsideGeofence changes
HyperTrack.subscribeToOrders { orders ->
handlePresence(orders["my_order"]?.isInsideGeofence)
}