【问题标题】:Ionic local Notifications based on selected and saved date and time in localstorage基于在本地存储中选择和保存的日期和时间的离子本地通知
【发布时间】:2020-12-28 06:27:25
【问题描述】:

我正在尝试使用 cordova-plugin-local-notification 在我的 ionic 应用程序中配置本地通知。但它不起作用。

请指出我在哪里做错了。

现在我正在使用以下查询来设置通知。

localStorage.setItem("notifytime", "3600");
    var notiftime = localStorage.getItem("notifytime");
    this.localNotifications.schedule({
      text: 'Delayed ILocalNotification',
      trigger: {at: new Date(new Date().getTime() + notiftime)},
      led: 'FF0000',
      sound: null
   });

【问题讨论】:

    标签: json ionic-framework local-storage localnotification


    【解决方案1】:

    notiftime变量转换为int之前:

    var notiftime = localStorage.getItem("notifytime");
    var time = parseInt(notiftime);
    new Date(new Date().getTime() + time);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-21
      • 1970-01-01
      • 2016-03-05
      • 1970-01-01
      • 2015-06-20
      • 1970-01-01
      • 2012-07-17
      • 2011-06-06
      相关资源
      最近更新 更多