init method
void
init()
Implementation
void init() {
FlutterForegroundTask.initCommunicationPort();
FlutterForegroundTask.addTaskDataCallback(_onReceiveTaskData);
FlutterForegroundTask.init(
androidNotificationOptions: AndroidNotificationOptions(
channelId: 'openlistapp_service',
channelName: 'OpenListApp Service',
onlyAlertOnce: true,
),
iosNotificationOptions: const IOSNotificationOptions(
showNotification: false,
playSound: false,
),
foregroundTaskOptions: ForegroundTaskOptions(
eventAction: ForegroundTaskEventAction.repeat(5000),
autoRunOnBoot: true,
autoRunOnMyPackageReplaced: true,
allowWakeLock: true,
allowWifiLock: true,
),
);
}