cordova-plugin-local-notifications
cordova-plugin-local-notifications copied to clipboard
Not working if app killed
trigger: { every: { hour: 10, minute: 0 }, count: 1 }
I am using ionic 3 and found Notification is not working if app killed.
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; };`
This repository obviously is abandoned. :-(