References
DriveKitListener is an interface that can be passed as a parameter during the DriveKit Core module initialization. It gives useful events about the user lifecycle.
interface DriveKitListener {
fun onConnected()
fun onDisconnected()
fun onAuthenticationError(errorType: RequestError)
fun userIdUpdateStatus(status: UpdateUserIdStatus, userId:String?)
fun onAccountDeleted(status: DeleteAccountStatus)
}
Method | Description |
---|---|
onConnected() | The user has been successfully logged |
onDisconnected() | The user has been disconnected (manual logout or the account is disabled/deleted) |
onAuthenticationError(errorType: RequestError) | |
userIdUpdateStatus(status: UpdateUserIdStatus, userId:String?) | |
onAccountDeleted(status: DeleteAccountStatus) | The delete account request has been processed with a DeleteAccountStatus state value |
UpdateUserIdStatus
is an enum that explains the request status after a userId has asked to be changed.enum class UpdateUserIdStatus {
UPDATED, FAILED_TO_UPDATE, INVALID_USER_ID, ALREADY_USED, SAVED_FOR_REPOST
}
Value | Description |
---|---|
UPDATED | The userId has been successfully updated |
FAILED_TO_UPDATE | Occurs when DriveKit is not configured yet or if the new userId is the same as the old one |
INVALID_USER_ID | Error returned when the new userId is blank |
ALREADY_USED | The new userId is already taken by another user |
SAVED_FOR_REPOST | The request failed but a retry will be done |
RequestError
is an enum that describes the error type of a DriveKit request.enum class RequestError {
NO_NETWORK, UNAUTHENTICATED, FORBIDDEN, SERVER_ERROR, CLIENT_ERROR, UNKNOWN_ERROR, LIMIT_REACHED
}
Value | Description |
---|---|
NO_NETWORK | The user has no or a bad connection during the request. |
UNAUTHENTICATED | A request has been launched but the user is not logged (401 error). |
FORBIDDEN | A 403 error occurred. You might don't have access to call that service. Please contact the DriveQuant to learn more. |
SERVER_ERROR | Drivequant's backend responds with a 500 server error. |
CLIENT_ERROR | Drivequant's backend responds with a 400 error different than UNAUTHENTICATED , FORBIDDEN and LIMIT_REACHED |
UNKNOWN_ERROR | An unknown error occurred, please contact the Drivequant team to investigate the issue. |
LIMIT_REACHED | The DriveKit API key has reached the accounts number limit. Please contact the Drivequant team. |
DeleteAccountStatus
is an enum that describes the deletion status. It can have 3 values: SUCCESS
: Account deleted successfullyFAILED_TO_DELETE
: Account not deleted, an error has occurredFORBIDDEN
: Account deletion not activated for this team
DKWeather
is an enum that describe each category of weather during a trip. It can have these values:UNKNOWN
SUN
CLOUD
FOG
RAIN
SNOW
ICE
Last modified 1mo ago