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.

app.dart
import 'package:sentiance_core/sentiance_core.dart';

final sentiance = SentianceCore();

void enableSentianceDetections() async {
  try {
    await sentiance.enableDetections();
    print("Detections are now enabled.");
  } on EnableDetectionsError catch (e) {
    print('Failed to enable detections, reason: ${e.reason}');
  } catch (e) {
    print(e);
  }
}

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.

Last updated