admin管理员组

文章数量:1023078

the notifications are not triggered when the device is locked or app is killed, but when I open the device then it comes

I have set the awesome notifications as follows:

import 'package:awesome_notifications/awesome_notifications.dart';
Future<void> main() async {
  //debugPaintSizeEnabled = true;

  WidgetsFlutterBinding.ensureInitialized();

  // Always initialize Awesome Notifications
  await NotificationController.initializeLocalNotifications();
  await NotificationController.initializeIsolateReceivePort();
  await Geolocator.requestPermission();
  runApp(const MyApp());
}

  static List<Map<String, dynamic>> allWeeksNotifications = [
    {
      'notificationweekday': 'Sunday',
      'notificationtime': '09:00',
      'notificationtitle': 'Ssunday Notification',
      'notificationbody': 'it is Sunday',
      'pagetype': 'tab2',
      'pageindex': 2,
      'notificationid': 1030
    }]

  static Future<void> initializeLocalNotifications() async {
    await AwesomeNotifications().initialize(
      null,
      [
      NotificationChannel(
        channelKey: 'adan_channel',
        channelName: 'Adan Notifications',
        channelDescription: 'Notifications for Adan prayer times',
        defaultColor: Colors.green,
        ledColor: Colors.green,
        importance: NotificationImportance.High,
        channelShowBadge: true,
      ),
    ],);

    initialAction = await AwesomeNotifications()
        .getInitialNotificationAction(removeFromActionEvents: false);
  }

here is my try

the notifications are not triggered when the device is locked or app is killed, but when I open the device then it comes

I have set the awesome notifications as follows:

import 'package:awesome_notifications/awesome_notifications.dart';
Future<void> main() async {
  //debugPaintSizeEnabled = true;

  WidgetsFlutterBinding.ensureInitialized();

  // Always initialize Awesome Notifications
  await NotificationController.initializeLocalNotifications();
  await NotificationController.initializeIsolateReceivePort();
  await Geolocator.requestPermission();
  runApp(const MyApp());
}

  static List<Map<String, dynamic>> allWeeksNotifications = [
    {
      'notificationweekday': 'Sunday',
      'notificationtime': '09:00',
      'notificationtitle': 'Ssunday Notification',
      'notificationbody': 'it is Sunday',
      'pagetype': 'tab2',
      'pageindex': 2,
      'notificationid': 1030
    }]

  static Future<void> initializeLocalNotifications() async {
    await AwesomeNotifications().initialize(
      null,
      [
      NotificationChannel(
        channelKey: 'adan_channel',
        channelName: 'Adan Notifications',
        channelDescription: 'Notifications for Adan prayer times',
        defaultColor: Colors.green,
        ledColor: Colors.green,
        importance: NotificationImportance.High,
        channelShowBadge: true,
      ),
    ],);

    initialAction = await AwesomeNotifications()
        .getInitialNotificationAction(removeFromActionEvents: false);
  }

here is my try

本文标签: flutterAwesome Notifications not triggered when device is lockedStack Overflow