Steffaan / cordova-plugin-local-notifications

Cordova Local Notifications Plugin
Apache License 2.0
31 stars 38 forks source link

Not working if app killed #30

Open CompRider opened 4 years ago

CompRider commented 4 years ago

trigger: { every: { hour: 10, minute: 0 }, count: 1 }

I am using ionic 3 and found Notification is not working if app killed.

sarahbock commented 4 years ago

I'm running into the same issue.

I'm running Cordova v9.0.0 Android v 8.1.0 Device OPPO AX5

The below is working when app is open or in background but not when it's been closed. Any ideas appreciated!

I have tried changing app settings to "allow auto start up" and "allow background running".

Have added skipLocalNotificationReady to index.htm

`var app = { initialize: function() { "use strict"; document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); },

onDeviceReady: function() { "use strict"; this.receivedEvent('deviceready'); },

receivedEvent: function(id) {
    "use strict";
    $(".listening").css("display","none");
    $(".received").css("display","block");

    cordova.plugins.notification.local.requestPermission(function (granted) {
        var soon = new Date();
        soon.addSeconds(10);

        cordova.plugins.notification.local.schedule({
                id: 1,
                title: 'My first notification',
                text: 'Thats pretty easy...',
                //smallIcon: 'res://logo.png',
                vibrate:true,
                lockscreen:true,
                foreground: true,
                badge:1,
                trigger: {at: soon}
            });
    });
}

}; Date.prototype.addSeconds = function(d) {"use strict"; this.setTime(this.getTime() + (d*1000)); return this; };`

Marcophono2 commented 3 years ago

This repository obviously is abandoned. :-(