Get started

Prerequisite

Before starting DriveKit Challenge module integration, make sure that you have initialized DriveKit, especially if you have disable the SDK auto-initialization.

If you use DriveKit Challenge without having initialized DriveKit, an exception will be generated and the SDK will not work in your application.

Integration

Get module from repository

To add Challenge module to your app, add the following line to your dependencies in your application build.gradle file:

dependencies {
   implementation 'com.drivequant.drivekit:drivekit-challenge:$drivekit_version'
}

Replace $drivekit_version with the DriveKit version you are using in your app

Initialization

If you have disabled the SDK auto-initialization, an initialization phase is required to use the functions offered by the Challenge component. To initialize Challenge component in your app, you must call the initialization method in onCreate method of your application class.

fun initialize()

Synchronize list of challenges

To synchronize the list of challenges, call the following method:

fun getChallenges(
   listener: ChallengesQueryListener,
   synchronizationType: SynchronizationType = DEFAULT
)

ChallengesSyncStatus and Challenge models are described in the References part.

Take a look at the open-source code of our DriveKit Demo App to see how it is implemented.

Retrieve local challenge list

You can retrieve the list of challenges stored in the DriveKit local database by calling the previous method but with the SynchronizationType parameter to CACHE.

Synchronize challenge detail

You need to call the following method if you want to get more details and statistics about a defined challenge:

fun getChallengeDetail(
    	challengeId: String,
    	listener: ChallengeDetailQueryListener,
    	synchronizationType: SynchronizationType = DEFAULT
)

This method have the following parameters:

ChallengeDetailSyncStatus and ChallengeDetail models are described in the References part.

Take a look at the open-source code of our DriveKit Demo App to see how it is implemented.

Retrieve local challenge detail data

You can retrieve the details of a given challenge stored in the DriveKit local database by calling the previous method but with the SynchronizationType parameter to CACHE.

Join a challenge

To be able to join a given challenge, you can call the following method:

fun joinChallenge(
    	challengeId: String,
    	listener: JoinChallengeQueryListener
)

This method have the following parameter:

JoinChallengeSyncStatus enum values are described in the References part.

Take a look at the open-source code of our DriveKit Demo App to see how it is implemented.

Last updated