Trip recording widget
Principle
The widget is a button that lets the user control the trip recording. Possible actions are:
- Start a trip recording 
- Check that the current trip is being recorded 
- Stop a trip recording 
- Cancel a trip recording. 
How to display the trip recording widget?
There are two ways to integrate the trip recording widget into your application:
The first one is embedding it in XML layout:
<fragment
    android:id="@+id/start_stop_trip_button"
    android:name="com.drivequant.drivekit.tripanalysis.triprecordingwidget.recordingbutton.DKTripRecordingButton"
    android:layout_width="match_parent"
    android:layout_height="60dp" />The second way is getting it from DriveKitTripAnalysisUI:
fun newTripRecordingButtonFragment(): DKTripRecordingButtonIf you need to programmatically display the stop trip confirmation dialog (for example, when the user taps a start trip notification), you can call the public method showConfirmationDialog() of the DKTripRecordingButton instance. 
Warning: This dialog won’t appear if the DKTripRecordingUserMode doesn’t allow the user to end a trip.
Trip recording widget configurations
The button has 4 configurations to cover all possible scenarios, and its display can be adjusted using the tripRecordingUserMode parameter.
- NONE: The button is hidden and the trip recording is fully automatic. This is the simplest mode, and the one we prefer.
- START_STOP: The button is displayed and the user has total control over the trip recording cycle: start, stop and cancel. In this configuration, autostart remains active.
- START_ONLY: The user can start a trip manually but cannot stop or cancel it under any circumstances. Recording stops automatically. In this configuration, autostart remains active.
- STOP_ONLY: The user cannot start a trip manually. The start of a trip is detected automatically. The user can only stop the trip to get his results or cancel the recording
The default value is START_STOP.
To set the button mode, call the following method:
var tripRecordingUserMode: DKTripRecordingUserModeLast updated
Was this helpful?

