This is ionic(Not ionic v2) with angularjs. When a local notification is scheduled, I see '$cordovaLocalNotification:schedule' getting triggered but not '$cordovaLocalNotification:trigger'.
$rootScope.$on('$cordovaLocalNotification:schedule',
function (event, notification, state) {
// ...
alert("Local Notification scheduled");
});
$rootScope.$on('$cordovaLocalNotification:trigger',
function (event, notification, state) {
// ...
alert("Local Notification triggered")
});
Providing the methods below using which notifications are triggered:
$rootScope.scheduleNotification = function (title,notificationMessage) {
$cordovaLocalNotification.schedule({
id: 1,
title: title,
text: notificationMessage,
data: {
customProperty: 'custom value'
}
}).then(function (result) {
// ...
});
};
All the injections are set and I presume without that scheduled listener will not work!
After googling found that, tweaking of existing plugin katzer/cordova-plugin-local-notifications is necessary to support iOS 10 changes to Push Notification & LocalNotifications to support the new Notification center features.
As a temporary fix, do the below:
And Hurray! I got it working :-)