2

我正在尝试向我的应用程序添加本地日程安排通知,但它不起作用。我的应用程序有日期时间选择器,所以我正在尝试发送特定日期和时间的通知。我怎样才能做到这一点?我的代码如下。提前感谢您的评论。

@override
      void initState() {
        initSettings();
        tz.initializeTimeZones();
        super.initState();
      }
    
      Future<void> displayNot(String postBaslik, DateTime postZaman) async {
        var androidDetails = new AndroidNotificationDetails("channelId", "channelName", "channelDescription",importance: Importance.high);
        var iosDetails = new IOSNotificationDetails();
        var generalNotificationDetails= new NotificationDetails(android: androidDetails, iOS: iosDetails);
        await notificationsPlugin.show(0, "title", "body", generalNotificationDetails);
    
    void initSettings() async {
      var initAndorid = AndroidInitializationSettings('my_logo');
      var initIOS= IOSInitializationSettings();
      var initSetting = InitializationSettings(android: initAndorid, iOS: initIOS);
      await notificationsPlugin.initialize(initSetting);
    }
4

0 回答 0