phonegap本地通知-每天 [英] phonegap local notification - daily

查看:79
本文介绍了phonegap本地通知-每天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://github.com/katzer/cordova-开发的phonegap插件中插件本地通知 如果我想在14:00安排每日通知,应如何设置参数?我该怎么约会呢?

In the phonegap plugin developed by https://github.com/katzer/cordova-plugin-local-notifications if I want to schedule a daily notification at 14:00, how should set for the paras? What should I put for date?

window.plugin.notification.local.add({
    id:         String,  // A unique id of the notifiction
    date:       Date,    // This expects a date object
    message:    String,  // The message that is displayed
    title:      String,  // The title of the message
    repeat:     String,  // Either 'secondly', 'minutely', 'hourly', 'daily', 'weekly', 'monthly' or 'yearly'
    badge:      Number,  // Displays number badge to notification
    sound:      String,  // A sound to be played
    json:       String,  // Data to be passed through the notification
    autoCancel: Boolean, // Setting this flag and the notification is automatically canceled when the user clicks it
    ongoing:    Boolean, // Prevent clearing of notification (Android only)
}, callback, scope);

谢谢 锤子

推荐答案

以下示例显示了如何计划每天从现在开始60秒触发的本地通知.

The following example shows how to schedule a local notification which will be triggered every day, 60 seconds from now.

  var d = new Date();
  d.setHours(14); 

window.plugin.notification.local.add({
    id:      1,
    title:   'Reminder',
    message: 'Dont forget to buy some flowers.',
    repeat:  'daily',
    date:    d
});

这篇关于phonegap本地通知-每天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆