6

mir eine App mit cordova Entwicklung und ich verwende diese Plugin jeden Tag eine lokale Benachrichtigung 06.00 https://github.com/katzer/cordova-plugin-local-notificationsZeitplan eine lokale Meldung jeden Tag mit phonegap cordova

Alles zu planen funktioniert gut, diese ist der Code, den ich um 6 Uhr jeden Tag de Mitteilung

/*Set 6 o'clock*/ 
function setTestAlarm() { 
    var notify = new Date(); 
    notify.setHours(18,00,00,00); 

    localNotification.add({ 
     id:  1, 
     title: 'My app', 
     message: 'Hi this is a notification', 
     repeat: 'daily', 
     date: notify, 
     autoCancel: true, 
     ongoing: true, 
    }); 

ich tat Prüfung und Benachrichtigung angezeigt wird eingestellt bin mit aber nur für 9 aufeinanderfolgende Tage und stoppt dann erscheinen. Was mache ich falsch?

Dank

Antwort

7

Obwohl seine spät, versuchen Sie Folgendes an: https://github.com/katzer/cordova-plugin-local-notifications/wiki/11.-Samples

cordova.plugins.notification.local.schedule({ 
    id: 1, 
    text: "Good morning!", 
    firstAt: tomorrow_at_6_am, 
    every: "day" // "minute", "hour", "week", "month", "year" 
}); 

Für tomorrow_at_6_am können Sie versuchen, die folgenden:

var today = new Date(); 
var tomorrow = new Date(); 
tomorrow.setDate(today.getDate()+1); 
tomorrow.setHours(6); 
tomorrow.setMinutes(0); 
tomorrow.setSeconds(0); 
var tomorrow_at_6_am = new Date(tomorrow);