configure method

Future<bool> configure({
  1. required IosConfiguration iosConfiguration,
  2. required AndroidConfiguration androidConfiguration,
})
override

Implementation

Future<bool> configure({
  required IosConfiguration iosConfiguration,
  required AndroidConfiguration androidConfiguration,
}) async {
  _channel.setMethodCallHandler(_handle);

  final CallbackHandle? handle =
      PluginUtilities.getCallbackHandle(androidConfiguration.onStart);

  if (handle == null) {
    throw 'onStart method must be a top-level or static function';
  }

  final result = await _channel.invokeMethod(
    "configure",
    {
      "background_handle": handle.toRawHandle(),
      "is_foreground_mode": androidConfiguration.isForegroundMode,
      "auto_start": androidConfiguration.autoStart,
      "auto_start_on_boot": androidConfiguration.autoStartOnBoot,
      "current_day": androidConfiguration.currentDay,
      "current_jalali_date": androidConfiguration.currentJalaliDate,
      "current_miladi_date": androidConfiguration.currentMiladiDate,
      "current_hijri_date": androidConfiguration.currentHijriDate,
      "notification_channel_id": androidConfiguration.notificationChannelId,
      "foreground_notification_id":
          androidConfiguration.foregroundServiceNotificationId,
    },
  );

  return result ?? false;
}