微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

基于本地存储中所选日期和时间的离子本地通知

如何解决基于本地存储中所选日期和时间的离子本地通知

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

请建议我在哪里做错了。

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

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
   });

解决方法

notiftime变量转换为int之前的值:

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。