每日定期通知扑朔迷离

问题描述

我每天都尝试使用插件flutter_local_notifications 用户发送定期通知,但是该插件可用的资源仅包含代码,并且难以理解,我已经完成了该插件的设置,如下:

我通过引用medium等众多资源和其他一些网站来做很多事情,所以有人可以写一种每天向用户(Android和iOS)发送定期通知方法吗?谢谢!

解决方法

写完该评论后,我做了一些研究,到目前为止对我来说是有效的:

Future<void> showAlertNotification() async {
    var time = Time(8,0);
    var androidChannel = AndroidNotificationDetails(
        'channelID','channelName','channelDescription',importance: Importance.defaultImportance,priority: Priority.defaultPriority,playSound: true);

    var iosChannel = IOSNotificationDetails();
    var platformChannel =
        NotificationDetails(android: androidChannel,iOS: iosChannel);
   await flutterLocalNotificationsPlugin.showDailyAtTime(2,'notification title','message here',time,platformChannel,payload: 'new payload'));
  }