簡體   English   中英

Flutter Awesome Notifications 預定通知不起作用

[英]Flutter Awesome Notifications scheduled notification doesn't work

這是我在 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);

嘗試將 channelKey 從 basic_channel 更改為 scheduled

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM