Trip Manager Status

The application can register a listener to be informed of important lifecycle events such as trip detection enabled, recording started, and/or failures. This can be done by adding a listener while the app is running.

// Listen for trip manager status updates
ImsTripManager.addTripStatusListener(object : ImsTripManager.TripStatusListener {
    override fun onTripStatusUpdate(tripStatus: ImsTripStatus) {
        tripStatusData.value = tripStatus    // Sample app uses LiveData
        when (tripStatus.tripState) {
            ImsTripStatus.TripState.ENABLED -> {}
            ImsTripStatus.TripState.STARTED -> Log.d(LOG_TAG, "Trip Started.")
            ImsTripStatus.TripState.STOPPED -> Log.d(LOG_TAG, "Trip Ended.")
            ImsTripStatus.TripState.DISABLED -> {}

You can also query the current trip manager state at any time.


Last updated