Trip Manager Control

Enable Trip Detection and Recording

Trip detection and recording does not happen until you explicitly enable it at least once. Use the enableTripManager method to enable trip detection, recording, and trip file upload. Use the disableTripManager method to stop, such as when the user logs out.

Note that once ImsTripManager is enabled, it remains enabled even when the application restarts or the phone reboots. You only need to explicitly re-enable it if you previously disabled it.

When the trip manager is enabled it performs a comprehensive status check. Since some of the configuration is done in background, no status is returned from the enableTripManager method. Instead, you should monitor the status value in the trip status listener callback in case a user-addressable problem is detected. Typical problems are missing permissions (e.g. background location) or phone state (e.g. Bluetooth turned off).

// Enable Trip Detection using the current user's Identity
ImsTripManager.enableTripManager(context, currentIdentity);

//Disable Trip Detection but do not delete pending trip files
ImsTripManager.disableTripManager(context, false)

Note that trip detection will only happen automatically if you specify at least one validator.

Programmatically Starting and Stopping Trips

The trip detection manager must be enabled before the trip recorder can be started or stopped programmatically (see previous section).

    ImsTripManager.startTrip(context, 0, null)
    // ...
    ImsTripManager.stopTrip(context, 0, null)

The start command has no effect if the recorder is already started (or if trip detection is disabled), and the stop command has no effect if the recorder's not already running.

  • If you have specified no validator (TripValidator.PHONE and/or TripValidator.DEVICE), then, once started, the trip recorder will continue recording indefinitely until you issue the stop command.

  • If you have specified at least one validator, trip recording will stop automatically using the validator, or when you issue the stop command, whichever comes first.

Last updated