5. Enabling Detections
After creating a Sentiance user, you can enable SDK detections. This will allow the Sentiance SDK to run in the background, and intelligently detect a user's real-world movements, while collecting sensor, location, and motion activity data.
Sentiance.shared.enableDetections { result, error in
guard let result = result else {
NSLog("Failed to enabled detections due to reason \(error!.failureReason)")
return
}
NSLog("Successfully enabled detections")
}
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
default:
// Other enum values don't apply for success scenarios
}
If detections are blocked, you can check the SDK status to see what's blocking them. Usually, this is caused by insufficient permissions or a disabled location tracking.
Last updated