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:

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:

  • false - do not force a shift start
  • true - do force a shift start

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:

  • -1 - general error
  •  1 - the driver already started the shift
  •  2 - the driver started a shift on another device
  •  3 - the driver is beyond the allowable distance from the workplace to start a shift
  •  4 - the current time is either before or after the allowable shift start or end time
  •  5 - the driver is both beyond the allowable distance from the workplace, and the current time is either before or after the allowable shift start or end time

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:

  • false - not waiting for an end shift response
  • true - waiting for an end shift response