I’m currently migrating from ionic.io alpha to beta on my app and I noticed some strange behaviors:
The notification icon I setup on plugin config no longer shows up when I receive a notification. (If I send using the alpha API it works just fine)
The phone no longer plays the notification sound or vibrates (on alpha its working fine too)
I use a $state.go with a payload param on notification receiving. Using the alpha API, when the user clicks the notification or receive it with the app on foreground, he gets redirected just fine. Using te beta API he only gets redirected if the app is on the foreground.
Here’s the code I’m using:
var push = new Ionic.Push({
"debug": true,
"onNotification": function(notification) {
var payload = notification.payload;
console.log(notification, payload);
$state.go(payload['$state'],payload['$stateParams']);
},
"onRegister": function(data) {
push.saveToken(token); // persist the token in the Ionic Platform
},
"pluginConfig": {
"android": {
"icon": "push_icon",
"iconColor": "#F47D30"
},
So, did anyone had a similar problem or could help me out figuring it out?
I don’t have a solution, but I did find this issue:
the plugin’s author says:
yeah, I know guys. For now don’t use the notification section in the push payload. Put everything in the data section. That’s why I’ve documented it that way in all the examples.
I didn’t find a way to send through Ionic API with the notification section empty.
I switched to Google GCM and Apple Push for my app and everything is working fine now.