typescript - 如何设置每 X 分钟本地通知一次?

标签 typescript ionic-framework ionic2 ionic-native

我正在尝试这样设置它们:

this.localNotifications.schedule({
              id: 0,
              text: 'Message',
              sound: this.platform.is('android') ? 'file://sound.mp3' : 'file://beep.caf',
              every: this.NotificationsTimer,
              icon: 'notification_icon',
              led: '#ff00c3'
            });

this.NotificationsTimer 的值为 5。但它不起作用,我应该如何让它起作用?

最佳答案

您现在使用 Ionic 获得的版本似乎是 0.8.5。那么您应该将 every 与以下字符串之一一起使用:

  • 第二个
  • 分钟
  • 小时
  • 季度

如果您使用的是最新版本(0.9.x,目前处于测试阶段),则有更多选项。以下信息取自 cordova-plugin-local-notifications repo :

重复,从现在开始:

trigger: { every: 'day', count: 5 }

或者每次日期匹配时:

trigger: { every: { month: 10, day: 27, hour: 9, minute: 0 } }

关于typescript - 如何设置每 X 分钟本地通知一次?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46558072/

相关文章:

javascript - Elasticsearch-模糊搜索未给出建议

typescript - 为什么 TypeScript 中的 instanceof 不适用于继承的类?

TypeScript Object.assign 混淆

java - 我得到 "' :mergeDebugAssets"-Error when compiling my App with Ionic

javascript - window.open (“sms:…” ) 适用于 android,但不适用于 ios ionic 1

reactjs - 如何从 React 功能组件声明 TypeScript 静态方法

node.js - 尝试构建遗留 Node/Angular/ ionic 应用程序,在node-gyp命令上失败

angular - ‘local' 的所有声明在 ionic 2 中必须具有相同的修饰符

typescript - "ion-slides "选项 "has been deprecated",现在呢?

mongodb - 按多个值过滤对象