Trip Manager

enableImsTripManager

Description

Enable the IMS Trip Manager. Trip detection and recording do not happen until you explicitly enable it at least once. Use this method to enable trip detection, recording, and trip file upload.

Returns

  • Promise<any>: A promise that resolves when the operation is complete.

Usage example:

import { enableImsTripManager } from "ims-react-native/src";

enableImsTripManager().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

disableImsTripManager

Description

Disable the IMS Trip Manager. Use this method to stop, such as when the user logs out.

Returns

  • Promise<any>: A promise that resolves when the operation is complete.

Usage example:

import { disableImsTripManager } from "ims-react-native/src";

disableImsTripManager().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

startTrip

Description

Start a trip. The trip detection manager must be enabled before the trip recorder can be started or stopped programmatically. The start command has no effect if the recorder is already started (or if trip detection is disabled).

Returns

  • Promise<any>: A promise that resolves when the trip starts.

Usage example:

import { startTrip } from "ims-react-native/src";

startTrip().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

stopTrip

Description

Stop the current trip. The trip detection manager must be enabled before the trip recorder can be started or stopped programmatically. The stop command has no effect if the recorder is not already running.

If you have specified no validator (AndroidTripValidator.PHONE and/or AndroidTripValidator.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.

Returns

  • Promise<any>: A promise that resolves when the trip stops.

Usage example:

import { stopTrip } from "ims-react-native/src";

stopTrip().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

addTripStatusListenerAndroid

Description

Add a listener for trip status updates on Android. 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.

Returns

  • Promise<any>: A promise that resolves when the listener is added.

Usage example:

import { addTripStatusListenerAndroid } from "ims-react-native/src";

addTripStatusListenerAndroid().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

removeTripStatusListenerAndroid

Description

Remove the trip status listener on Android.

Returns

  • Promise<any>: A promise that resolves when the listener is removed.

Usage example:

import { removeTripStatusListenerAndroid } from "ims-react-native/src";

removeTripStatusListenerAndroid().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

setStatusHandlerIos

Description

Set a status handler on iOS.

Returns

  • Promise<any>: A promise that resolves when the status handler is set.

Usage example:

import { setStatusHandlerIos } from "ims-react-native/src";

setStatusHandlerIos().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

removeStatusHandlerIos

Description

Remove the status handler on iOS.

Returns

  • Promise<any>: A promise that resolves when the status handler is removed.

Usage example:

import { removeStatusHandlerIos } from "ims-react-native/src";

removeStatusHandlerIos().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

uploadAllTripDataIos

Description

Upload all trip data on iOS, including any log files. This might be useful to call to ensure no data files or logs are lingering.

Returns

  • Promise<any>: A promise that resolves when the trip data is uploaded.

Usage example:

import { uploadAllTripDataIos } from "ims-react-native/src";

uploadAllTripDataIos().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

tripsToUploadIos

Description

Get the amount of trips to upload on iOS.

Returns

  • Promise<any>: A promise that resolves with the list of trips.

Usage example:

import { tripsToUploadIos } from "ims-react-native/src";

tripsToUploadIos().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

deleteAllTripDataIos

Description

Delete all persisted trip data and logs on iOS. This might be useful in the event that the user has been logged out.

Returns

  • Promise<any>: A promise that resolves when the trip data is deleted.

Usage example:

import { deleteAllTripDataIos } from "ims-react-native/src";

deleteAllTripDataIos().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

getFileLocationIos

Description

Return file location used by the SDK on iOS.

Returns

  • Promise<any>: A promise that resolves with the file location.

Usage example:

import { getFileLocationIos } from "ims-react-native/src";

getFileLocationIos().then((result: string) => {
        console.log(result);
      }).catch((error: Error) => {
        console.log(error.message);
    });

Last updated