iOS ecb callbacks stop firing after a few days. When the app is first installed they work great, but eventually stop firing when the app is closed and opened again. I show a popup with the notification’s message when user clicks the notification. Maybe the problem is because I register the device from inside of a controller that eventually is out of scope??? Maybe, but the ecb is scoped to the window object like so:
.run(function ($ionicPlatform, $cordovaVibration, $cordovaDialogs) {
$ionicPlatform.ready(function () {
window.onNotificationAPN = function (event) {
$cordovaDialogs.alert(event.alert);
}
});
})
And here in a controller I register the device and tell APNS ecb is
window.onNotificationAPN:
window.errorHandler = function (error) {
alert(error);
};
tokenHandler = function (result) {
alert('device token: ' + result)
};
pushNotification.register(
tokenHandler,
window.errorHandler, {
"badge": "true",
"sound": "true",
"alert": "true",
"ecb": "window.onNotificationAPN"
});
I’m stumped, any ideas?