I am using Ionic push notifications for both Android and iOS.
On Android they work perfectly fine both when fired manually and also programatically via the API. On iOS it seems that they only come in manually via Ionic Cloud. So far I am not sure what is causing this however I noticed something that I am not sure about on the docs.
On the Ionic Docs for Push notifications there seem to be two different event handlers for when notifications come into the app. One being the one I am currently using:
$scope.$on('cloud:push:notification', function(event, data) {
var msg = data.message;
alert(msg.title + ': ' + msg.text);
});
and the other being
push.on('notification', function(data) {
// do something with the push data
// then call finish to let the OS know we are done
push.finish(function() {
console.log("processing of push data is finished");
}, function() {
console.log("something went wrong with push.finish for ID = " + data.additionalData.notId)
}, data.additionalData.notId);
});
The former needs the $ionicPush
injection while the latter is initialized as follows:
var push = PushNotification.init({
"android": {
"senderID": "XXXXXXXXXXX",
"sound": "true",
"vibrate": "true"
},
"ios": {
"alert": "true",
"badge": "true",
"sound": "true"
},
"windows": {}
})
Can anyone please tell me which event handler I should use? I am thinking that this may have to do with me not receiving programmatic pushes on iOS
NOTE: Yes I have enabled push notifications and remote notifications on Xcode. Remember I am receiving manual pushes on iOS, just not the programmatic ones.
Thank you very much!