Safe Rider

class SafeRider

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Listener for fall survey answers after the accident workflow

Link copied to clipboard

Listener for protection status changes

Properties

Link copied to clipboard
Link copied to clipboard

Listener for protection status changes events

Link copied to clipboard
Link copied to clipboard

The current protection status

Link copied to clipboard

The current trip detection configuration

Functions

Link copied to clipboard

Add a listener for protection status changes The listener will be notified when the protection status changes

Link copied to clipboard
fun addTripDetectionListener(listener: LRTripDetectionListener)

Add a listener for trip detection events

Link copied to clipboard

Cancel the emergency request Do nothing if the is no current emergency request This method should not be handled by the client if @property showAccidentUi is set to true as the library will handle it.

Link copied to clipboard

Disable trip detection

Link copied to clipboard
fun enableTripDetection(vehicleType: LRVehicleType, resultListener: (LRResult) -> Unit? = null)

Enable trip detection Trip detection will scan the user activity to detect trips for the given vehicle type. When a trip is detected, the library will notify the client with the detected vehicle by calling the LRTripDetectionListener.onTripDetected(vehicleType) method for registered listeners. This method will check if the required permissions are granted before enabling trip detection. If not, it will return an error. This state is persisted and will be restored when the application is killed and restarted so that the client doesn't need to enable trip detection again.

Link copied to clipboard

Get the intent to start the accident workflow activity Return the intent to start the accident workflow activity when an accident is detected.

Link copied to clipboard
fun getConfigurationErrors(blockingErrorsOnly: Boolean = false): List<LRSafeRiderError>
Link copied to clipboard
fun muteTripDetection(isMuted: Boolean)

Mute trip detection analysis When trip detection is muted, the library will not analyze the user activity to detect trips. This method should be used when the client doesn't need trip detection analysis for a certain period of time. For instance, when a trip has already been detected and the client doesn't want to detect another trip. The main difference with SafeRider.disableTripDetection() is that the trip detection service is still running but the analysis is muted so that application can be restored if it has been killed by the system, or if an accident has occurred.

Link copied to clipboard

Remove all protection status listeners

Link copied to clipboard

Remove a listener for protection status changes Stops receiving protection status changes for the given listener

Link copied to clipboard
fun removeTripDetectionListener(listener: LRTripDetectionListener)

Remove a listener for trip detection

Link copied to clipboard

Report an undetected accident during the protection session This method will upload session data buffers to the server

Link copied to clipboard

Resume to an active state after an emergency This method should not be handled by the client if @property showAccidentUi is set to true as the library will handle it. In scenarios where the client wants to handle the emergency state by itself, this method should be called to resume the protection at the end of the emergency worfklow.

Link copied to clipboard

Send a fake emergency request

Link copied to clipboard
fun simulateFakeShock(shockDate: Long = System.currentTimeMillis())

Simulate a fake shock warning: this method should only be used for testing purposes

Link copied to clipboard
fun startProtection(vehicleType: LRVehicleType, userId: String, phoneNumber: String, firstName: String?, lastName: String?, tripId: String?): LRResult

Start the protection

Link copied to clipboard

Stop the alert countdown after an accident detected This method should not be handled by the client if @property showAccidentUi is set to true as the library will handle it.

Link copied to clipboard

Stop the protection

Link copied to clipboard
fun triggerFakeAlert(location: Location)

Trigger a fake alert warning: this method should only be used for testing purposes

Link copied to clipboard
fun triggerTripDetectionAnalysis(vehicleType: LRVehicleType)

Trigger a fake detection analysis by emulating an activity recognition event warning: this method should only be used for testing purposes