Flutter Awesome Notifications预定的通知不起作用

xwmevbvl  于 2022-12-24  发布在  Flutter
关注(0)|答案(1)|浏览(162)

这是notifications.dart文件中的scheduledNotification函数,当我调用这个函数时,是否必须以10秒的间隔发出通知

Future<void> scheduledNotification(int hour,int minute, int second) async {
      String timezom = await AwesomeNotifications().getUtcTimeZoneIdentifier();
      await AwesomeNotifications().createNotification(
          content: NotificationContent(
              id: uniqueId(),
              channelKey: 'basic_channel',
              title: "$bullAd is Dying",
              body: "Eat and Feed it",
              color: progressColor),
          schedule: NotificationCalendar(
              allowWhileIdle: true,
              repeats: true,
              millisecond: 0,
              second: second+10,
              hour: hour,
              minute: minute));
    }

int lastFeedHour = DateTime.now().hour;
int lastFeedMinute = DateTime.now().minute;
int lastFeedSecond = DateTime.now().second;
scheduledNotification(lastFeedHour,lastFeedMinute,lastFeedSecond);
rxztt3cl

rxztt3cl1#

尝试将channelKey从basic_channel更改为预定

相关问题