For the complete documentation index, see llms.txt. This page is also available as Markdown.

5. Enabling Detections

Learn how to turn on detections to allow the Sentiance SDK to begin monitoring trips and events.

After creating a Sentiance user, you should enable SDK detections. This will allow the SDK to run in the background, and intelligently detect the user's movements patterns, driving habits, and other activities.

Enable Detections

You can enable detections by calling enableDetections(). Here are examples of how to do that on each platform:

After detections are successfully enabled, you can determine whether the SDK is able to detect, by checking the detection status:

switch result.detectionStatus { // or Sentiance.shared.detectionStatus
case .enabledAndDetecting:
    // Detections are enabled and running
case .enabledButBlocked:
    // Detections are enabled but blocked (e.g. missing permission issue)
default:
    // Other enum values don't apply for the success scenario
}

Enabling Detections Is Persistent

When you enable detections, the SDK will remember this and automatically enable them the next time the app restart. Therefore, you do not need to enable them every time. You only need to make sure that you are properly initializing the SDK during every app startup.

If the resulting detection status is "enabled and detecting", then detections are successfully running. However, if the status is "enabled but blocked", then an issue is preventing detections from starting. Once the issue is resolved, detection will start running automatically. Most likely causes for blocked detection are:

  • Missing permission.

  • Location service disabled on the device.

  • OS restrictions, such as background execution restriction on Android.

  • Device is in airplane mode.

  • The user account is deactivated.

To find out the exact reason, head over to the next section to learn about how you can check the SDK's status.

Last updated