0

My App uses both flutter_foreground_task as well as awesome-notification for showing the notification.Notifications are working properly on Android devices but not showing on iOS devices.

Future<void> _initForegroundTask() async {
  print("in _initForegroundTask");
  await FlutterForegroundTask.init(
      androidNotificationOptions: AndroidNotificationOptions(
      channelId: 'app_demo',
      channelName: 'Refresh Index Notification',
     channelDescription: 'This notification appears when the Refresh Index service is          running.',
  channelImportance: NotificationChannelImportance.HIGH,
  priority: NotificationPriority.HIGH,
  iconData: const NotificationIconData(
    resType: ResourceType.mipmap,
    resPrefix: ResourcePrefix.ic,
    name: 'launcher',
  ),
  buttons: [
    const NotificationButton(id: 'stopButton', text: 'Stop'),
  ],
),
iosNotificationOptions: const IOSNotificationOptions(
  showNotification: false,
  playSound: false,

),
foregroundTaskOptions: const ForegroundTaskOptions(
  interval: 5000,
  autoRunOnBoot: true,
),
//printDevLog: true,

); }

I made the showNotification of iosNotificationOptions to true but after making it true, the app is crashing

Setting showNotifications to true of iosNotificationOptions.

0 Answers0