enableBackgroundDelivery method

Future<bool> enableBackgroundDelivery({
  1. List<StatisticsType>? statisticTypes,
  2. List<MetricType>? metricTypes,
  3. List<ActivityConfig>? activityConfigs,
  4. List<SleepConfig>? sleepConfigs,
  5. bool? includeEnhancedPermissions,
})

Implementation

Future<bool> enableBackgroundDelivery({
  List<StatisticsType>? statisticTypes,
  List<MetricType>? metricTypes,
  List<ActivityConfig>? activityConfigs,
  List<SleepConfig>? sleepConfigs,
  bool? includeEnhancedPermissions,
}) async {
  final result = await NativeSDKBridgeV3.enableBackgroundDelivery(
    connectionId: connectionId,
    forStatistics: statisticTypes?.map((e) => e.toJson()).toList(),
    forMetrics: metricTypes?.map((e) => e.toJson()).toList(),
    forActivityConfigs: activityConfigs?.map((e) => jsonEncode(e.toJson())).toList(),
    forSleepConfigs: sleepConfigs?.map((e) => jsonEncode(e.toJson())).toList(),
  );

  ExceptionHandler.checkException(result);

  return true;
}