Fairmatic

object Fairmatic

Fairmatic class is the entry point into the Fairmatic SDK. All methods are threadsafe.

Applications which want to record Fairmatic insurance trips for a driver may use this API. All drives when a period is in progress will be tagged with the period id. This period id will be made available in the reports and API that Fairmatic provides via Fairmatic.

Only one period may be active at a time. To switch the Fairmatic insurance period, the application can call the relevant startPeriod method directly. Switching periods or calling stop method stops any active drives. A drive with multiple insurance periods will be split into multiple trips for different insurance periods.

Functions

Link copied to clipboard

Returns an identifier which can be used to identify this SDK build.

Link copied to clipboard
fun getFairmaticSettings(context: Context, fairmaticSettingsCallback: FairmaticSettingsCallback)

Get the current state of settings affecting the Fairmatic SDK's normal operation. This method returns a com.fairmatic.sdk.classes.FairmaticSettingError object that contains a list of errors and warnings that are affecting Fairmatic's ability to detect trips and perform other tasks.

Link copied to clipboard

Initialize the Fairmatic SDK only if the com.drivekit.sdk.auto_init_enabled flag is set to false This method should be called in the onCreate() method of the application class.

Link copied to clipboard
fun setup(context: Context, fairmaticConfiguration: FairmaticConfiguration, fairmaticTripNotification: FairmaticTripNotification, fairmaticOperationCallback: FairmaticOperationCallback?)

Setup the Fairmatic SDK with a configuration. The application should call this method before anything else in the Fairmatic SDK. This API should should be called in onCreate() method of application class. If you don't have an application class, you should create one and specify it in your AndroidManifest.xml file. Calling this method multiple times with the same 'sdkKey' and 'driverId' in the com.fairmatic.sdk.classes.FairmaticConfiguration is a no-op. Once setup finishes, the com.fairmatic.sdk.classes.FairmaticOperationCallback is called (if provided) with the result of the setup operation. Callback is made on the Main Thread.

Link copied to clipboard
fun startDriveWithPeriod1(context: Context, trackingId: String, fairmaticOperationCallback: FairmaticOperationCallback?)

Call this method once the driver waits for a new ride or delivery request A manual trip with the given trackingId will be started immediately. If this is already in progress with the same trackingId, this call will be a no-op.

Link copied to clipboard
fun startDriveWithPeriod2(context: Context, trackingId: String, fairmaticOperationCallback: FairmaticOperationCallback?)

Call this method once the driver accepts the ride or delivery request A manual trip with the given trackingId will be started immediately. If this is already in progress with the same trackingId, this call will be a no-op.

Link copied to clipboard
fun startDriveWithPeriod3(context: Context, trackingId: String, fairmaticOperationCallback: FairmaticOperationCallback?)

Call this method once the driver starts the ride or delivery A manual trip with the given trackingId will be started immediately. The entire duration in this period will be recorded as a single trip. If this is already in progress with the same trackingId, this call will be a no-op.

Link copied to clipboard
fun stopPeriod(context: Context, fairmaticOperationCallback: FairmaticOperationCallback?)

Call this method once the driver completes the ride or delivery Ongoing trips will be stopped.

Link copied to clipboard
fun teardown(context: Context, fairmaticOperationCallback: FairmaticOperationCallback?)

Shuts down the Fairmatic framework. This may be called if the client wishes to turn off the Fairmatic framework to isolate the operations that the application is doing. This is a no-op if setup has not been called. Once teardown finishes, the com.fairmatic.sdk.classes.FairmaticOperationCallback is called (if provided) with the result of the teardown operation. Callback is made on the Main Thread.

Link copied to clipboard
fun wipeOut(context: Context, fairmaticOperationCallback: FairmaticOperationCallback?)

Wipe out all the data that fairmatic keeps locally on the device. When Fairmatic SDK is torn down, trip data that is locally persisted continues to remain persisted. The data will be uploaded when SDK setup is called at a later time. Wipeout should be used when the application wants to remove all traces of Fairmatic on the device. Data cannot be recovered after this call. NOTE: This call can be made when the SDK is not running. Call teardown to tear down a live SDK before making this call.**