startTracking method

  1. @override
Future<bool> startTracking({
  1. bool showNotification = true,
  2. bool useTransitionRecognition = true,
  3. bool useActivityRecognition = false,
  4. int detectionIntervalMillis = 10000,
  5. int confidenceThreshold = 50,
})
override

Starts tracking user activity

Implementation

@override
Future<bool> startTracking({
  bool showNotification = true,
  bool useTransitionRecognition = true,
  bool useActivityRecognition = false,
  int detectionIntervalMillis = 10000,
  int confidenceThreshold = 50,
}) async {
  try {
    final Map<String, dynamic> arguments = Platform.isAndroid
        ? {
            'showNotification': showNotification,
            'useTransitionRecognition': useTransitionRecognition,
            'useActivityRecognition': useActivityRecognition,
            'detectionIntervalMillis': detectionIntervalMillis,
            'confidenceThreshold': confidenceThreshold
          }
        : {};

    final bool? result =
        await _methodChannel.invokeMethod('startTracking', arguments);
    return result ?? false;
  } on PlatformException catch (e) {
    if (kDebugMode) {
      print('Error starting tracking: ${e.message}');
    }
    return false;
  }
}