Shifts
Overview
The Bringg Driver SDK for Android contains shift functionality you can implement in your apps and use to customize your apps' handling of shift events.
The shift functionality and the events you can customize includes the following:
- getting shift details
- getting shift status and customizing status success and failure events
- starting shifts and customizing start shift success and failure events
- ending shifts and customizing end shift success and failure events
- waiting for a response from the server that a shift ended
Starting a Shift
startShiftAndWaitForApproval
Use to start a driver's shift and wait for approval from the server. This method triggers a callback.
void startShiftAndWaitForApproval(boolean forceNewShift, StartShiftResultCallback startShiftResultCallback);
Parameters
forceNewShift boolean |
Indicates whether to force the start of a shift ignoring the driver's current shift status. The values are:
|
startShiftResultCallback StartShiftResultCallback |
Use to implement a new StartShiftResultCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for get start shift events. |
StartShiftResultCallback
onShiftStarted
Invoked when an attempt to start a shift succeeds.
void onShiftStarted()
onShiftStartFailed
Invoked when an attempt to start a shift fails.
void onShiftStartFailed(int responseCode)
Parameters
responseCode int |
A response code indicating the reason for the failure to start the shift. The values are:
|
Ending a Shift
endShift
Use to end a driver's shift.
void endShift(@NotNull EndShiftCallback callback)
Parameters
callback EndShiftCallback |
NOT NULLABLE Use to implement a new EndShiftCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for end shift events. |
EndShiftCallback
onEndShiftFailure
Invoked when an attempt to end a shift fails.
void onEndShiftFailure(int error)
Parameters
error int |
The error that occurred when the shift attempted to end. The value is -1, an irrecoverable HTTP error. |
onEndShiftRetryLater
Invoked when an attempt to end a shift results in a condition where the attempt cab be retried.
void onEndShiftRetryLater()
onEndShiftSuccess
Invoked when an attempt to end a shift succeeds.
void onEndShiftSuccess()
If the shift ends successfully, the onEndShiftSuccess method is called.
Getting Shift Status
getShift
Use to get a driver's shift detailed information.
@NotNull
Shift getShift()
Parameters
None
Method Type
shift Shift |
NOT NULLABLE A reference to a Shift data type containing the detailed information about the current shift. |
getShiftStatusFromRemote
Use to get the driver's current shift status from the remote device. This method triggers a callback.
void getShiftStatusFromRemote(@NotNull GetShiftResultCallback callback)
Parameters
callback GetShiftResultCallback |
NOT NULLABLE Use to implement a new GetShiftResultCallback instance, including the callback interface methods that will be invoked by the Bringg Driver SDK for Android for get shift status events. |
GetShiftResultCallback
onGetShiftStatusFailed
Invoked when an attempt to get shift details fails.
void onGetShiftStatusFailed(@Nullable Shift lastKnownShift)
Parameters
lastKnownShift Shift |
NOT NULLABLE A reference to a Shift data type containing the detailed information about the current shift. |
onGetShiftStatusResult
Invoked when an attempt to get shift details succeeds.
void onGetShiftStatusResult(@NotNull Shift shift)
Parameters
shift Shift |
NOT NULLABLE A reference to a Shift data type containing the detailed information about the current shift. |
waitingForEndShiftResponse
Use to determine if the device is waiting for a response from the server to end a driver's shift.
boolean waitingForEndShiftResponse()
Parameters
None
Method Type
boolean |
Indicates whether the device is waiting for an end shift response. The values are:
|
Updated about 6 years ago