Install the module

Run the following command to install the module (make sure to install the core module beforehand):

npm i @sentiance-react-native/crash-detection

Import the module

import SentianceCrashDetection from "@sentiance-react-native/crash-detection";

You can find a reference to all the types mentioned on this page here.

Vehicle Crash Event Detection

Listen to vehicle crash events:

import {addVehicleCrashEventListener} from "@sentiance-react-native/crash-detection";

const subscription = addVehicleCrashEventListener(vehicleCrashEvent => {
  // New vehicle crash event

// Don't forget to unsubscribe, typically in componentWillUnmount

Invoke a dummy vehicle crash event

// returns Promise<boolean>
await SentianceCrashDetection.invokeDummyVehicleCrash();

Check if crash detection is supported

// returns Promise<boolean>
const isCrashDetectionSupported =
  await SentianceCrashDetection.isVehicleCrashDetectionSupported();
if (isCrashDetectionSupported) {
  // setup vehicle crash event listener

Vehicle Crash Diagnostic Data

Listen to vehicle crash diagnostic data.

await SentianceCrashDetection.addVehicleCrashDiagnosticListener(diagnostic => {
    // New diagnostic data

Last updated