public final class ZendriveInsurance extends Object
All drives (automatically detected or manually started) 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 Zendrive.
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 stopPeriod stops any active drives (automatic or manual). A drive with multiple insurance periods will be split into multiple trips for different insurance periods.
Modifier and Type | Method and Description |
---|---|
static void |
startDriveWithPeriod1(Context context,
ZendriveOperationCallback callback)
Start a drive in Fairmatic insurance period 1.
|
static void |
startDriveWithPeriod2(Context context,
String trackingId,
ZendriveOperationCallback callback)
Start Fairmatic insurance period 2 in the SDK.
|
static void |
startDriveWithPeriod3(Context context,
String trackingId,
ZendriveOperationCallback callback)
Start Fairmatic insurance period 3 in the SDK.
|
static void |
startPeriod1(Context context,
ZendriveOperationCallback callback)
Deprecated.
This API will be removed in a future SDK release. If you are an existing
Fairmatic customer and use this API, please contact Zendrive support.
|
static void |
stopPeriod(Context context,
ZendriveOperationCallback callback)
Stop currently ongoing Fairmatic insurance period if any.
|
public static void startPeriod1(@NonNull Context context, @Nullable ZendriveOperationCallback callback)
Trips in this period will be detected automatically. If period 1 is already in progress in the SDK, this call will be a no-op.
This call will fail if the SDK is not setup yet and return the error code
ZendriveErrorCode.SDK_NOT_SETUP
callback
- called with the result of the operationpublic static void startDriveWithPeriod1(@NonNull Context context, @Nullable ZendriveOperationCallback callback)
A manual trip with trackingId com.zendrive.sdk.internal will be started immediately.
The entire duration in this period will be recorded as a single trip. If period 1 is already in progress with the same trackingId, this call will be a no-op.
callback
- called with the result of the operationpublic static void startDriveWithPeriod2(@NonNull Context context, @NonNull String trackingId, @Nullable ZendriveOperationCallback callback)
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 period 2 is already in progress with the same trackingId, this call will be a no-op.
trackingId
- an identifier which allows identifying this drive uniquely. This identifier
must be unique for this user. It may not be null or a empty string. It will
be truncated to 64 characters if it is longer than 64 characters. Passing invalid trackingId
is an error
.callback
- called with the result of the operationpublic static void startDriveWithPeriod3(@NonNull Context context, @NonNull String trackingId, @Nullable ZendriveOperationCallback callback)
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 period 3 is already in progress with the same trackingId, this call will be a no-op.
trackingId
- an identifier which allows identifying this drive uniquely. This identifier
must be unique for this user. It may not be null or a empty string. It will
be truncated to 64 characters if it is longer than 64 characters. Passing invalid trackingId
is an error
.callback
- called with the result of the operationpublic static void stopPeriod(@NonNull Context context, @Nullable ZendriveOperationCallback callback)
Ongoing trips will be stopped and auto trip detection is turned off.
callback
- called with the result of the operation