This guide will cover the offline handling in the Android DriverSDK. It currently supports offline handling only for Trips and Tasks. Shifts are not supported offline currently.
API Callback Structure
HTTransmitterService APIs have the following callback structure:
|onSuccess(Response Object)||Called on successful response from the server.|
|onOfflineSuccess()||Called on offline success. Cached request will be pushed to server when the device comes online.|
|onError(Exception exception)||Called on error either in API parameters/SDK state or on the server.|
[info] Offline EndTrip stops LocationService
In case of an offline EndTrip call, Android DriverSDK's LocationService would be stopped provided the driver doesn't have a Shift active at that moment.
The current approach has a caveat where if there is an offline EndTrip request on the SDK, subsequent StartTrip calls would fail. Before starting another trip, the offline EndTrip request needs to be pushed to the server which will happen automatically once the device comes online.