startRecord static method

Future<void> startRecord(
  1. DataType dataType,
  2. NotificationProperties? notificationProperties
)

Starts real-time data reading by specifying the data type.

This method will trigger a foreground service that has an ongoing(sticky) notification. The notification properties can be customized by specifying a NotificationProperties instance. The SamplePoint results that include the count of steps are emitted to the autoRecorderStream.

If there is an ongoing AutoRecorder service present, an exception will be thrown.

Implementation

static Future<void> startRecord(
  DataType dataType,
  NotificationProperties? notificationProperties,
) async {
  await _methodChannel.invokeMethod<void>(
    'startRecord',
    <String, dynamic>{
      'dataType': dataType.toMap(),
      'notification': notificationProperties?.toMap(),
    },
  );
}