Crash Insights
To learn about the Crash Insights feature, check out this page.
Prerequisites
The Crash Insights feature relies on additional library dependencies alongside the core SDK dependency. To start using this feature, you must first add these dependencies to you project.
Android
Open your app build.gradle file and add the Crash Detection dependency.
dependencies {
implementation(platform('com.sentiance:sdk-bom:<sentiance-version>'))
implementation('com.sentiance:sdk-crash-detection')
}Utilize the Crash Detection APIs
In this section, you’ll find examples showing how to check whether vehicle crash detection is supported on a device, how to subscribe to crash event notifications, and additional details about the contents of a crash event and how to test your integration.
Check if Vehicle Crash Detection Is Supported
There are several reasons why vehicle crash detection may not be supported on the device. The two most common of these are:
the feature is not enabled for your app;
the device lacks the necessary sensors (e.g. accelerometer).
You can check to see whether vehicle crash detection is support on the device, as follows:
Subscribe for Vehicle Crash Events
In order to be notified of vehicle crash events, you can specify the listener that the SDK will invoke when it detects a vehicle crash.
Checkout Real-time Listeners to read more about implementing the SDK's Listeners
Create a background.dart file under your project's lib folder with the following code:
Add the following code, depending on your target platform.
For iOS, add the following to your app delegate class:
For Android, add this code to your custom application class:
If you're calling other Crash Detection plugin APIs or other 3rd party plugin APIs inside your registerCrashDetectionListener Dart function, then you need to register these plugins with the Sentiance SDK. See this for more details.
Crash Event Details
A crash event contains the time and location of the detected crash, in addition to a number of metrics to estimate the severity of the crash:
Speed at impact
The estimated speed of the vehicle before the impact, in m/s.
Magnitude
The magnitude of the impact, in m/s².
Delta-V
The estimated change in velocity at impact, in m/s.
Confidence
The level of confidence that the accelerometer signal reflects a true crash pattern (range 0 - 100). It is recommended to filter out events below the confidence of 50.
Severity
A categorical severity of the crash (low, medium, high).
Test Your Integration
The final step is checking your integration, to make sure that your vehicle crash listener is properly set up to handle crash events. Add the following method call in your app to trigger a dummy crash event.
This would invoke your listener, passing it a dummy crash event. You can test how your app handles the event at runtime.
Crash Detection Diagnostic Information
It’s also possible to subscribe to additional diagnostic data produced by the SDK to better understand the state and decision-making of the crash detection and to facilitate testing.
Inside the registerCrashDetectionListener method described in the subscription section above, add the following code to register for crash diagnotic updates.
The result will reflect one of the following states:
Crash candidate detected
Crash candidate discarded - impact is too weak
Crash candidate discarded - transport mode is not a vehicle
Crash candidate discarded - pre-impact signal contains too much noise
Crash candidate discarded - speed before impact is too low
Crash candidate discarded - post-impact signal contains too much noise
Crash candidate discarded - speed after impact is too high
Last updated