5. Enabling Detections
Learn how to turn on detections to allow the Sentiance SDK to begin monitoring trips and events.
Enable Detections
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
}val sentiance = Sentiance.getInstance(context)
sentiance.enableDetections().addOnCompleteListener { operation ->
if (operation.isSuccessful) {
Log.d(TAG, "Successfully enabled detections")
} else {
val error = operation.error;
Log.e(TAG, "Failed to enabled detections due to reason {${error.reason}")
}
}val detectionStatus = operation.result.detectionStatus // or Sentiance.getInstance(context).detectionStatus
when (detectionStatus) {
DetectionStatus.ENABLED_AND_DETECTING ->
// Detections are enabled and running
DetectionStatus.ENABLED_BUT_BLOCKED ->
// Detections are enabled but blocked (e.g. missing permission issue)
else ->
// Other enum values don't apply for the success scenario
}Last updated