configure method
Future<bool>
configure({
- required IosConfiguration iosConfiguration,
- required AndroidConfiguration androidConfiguration,
override
Implementation
Future<bool> configure({
required IosConfiguration iosConfiguration,
required AndroidConfiguration androidConfiguration,
}) async {
_channel.setMethodCallHandler(_handleMethodCall);
_eventChannelListener?.cancel();
_eventChannelListener =
_eventChannel.receiveBroadcastStream().listen((event) {
_controller.sink.add(event);
});
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,
"initial_notification_content":
androidConfiguration.initialNotificationContent,
"initial_notification_title":
androidConfiguration.initialNotificationTitle,
"notification_channel_id": androidConfiguration.notificationChannelId,
"foreground_notification_id":
androidConfiguration.foregroundServiceNotificationId,
},
);
return result ?? false;
}