Hi 
I wanted to know if it exists a way to handle users clicks on Push Notifications (and if possible for both platform : Android and IOS) ?
For now I was using the cordova Push plugin with my own server with node-gcm and node-apn
I saw a click_action for gcm parameter but I can’t figure how this works.
Several use cases :
- Redirecting the user on a specific view (for example a messenger if he receives a new message)
- More advanced: like Twitter : we can follow users directly from the Push Notification without opening the app
If anyone knows if it’s possible or has a trick to handle that, it would be nice ! 
4 Likes
did you find any solution?
1 Like
Yes its there by default - you just have to handle it in your code inside the app. There is an event fired i forgot which one was it but the documentation provides it all
1 Like
You should add additional data to your notification (I’m using firebase) and manage it in the platform.ready() event and add something like this:
push.on('notification', (data) => {
let localData: any = data.additionalData;
if (localData.action) {
this.events.publish("notification:" + localData.action, localData);
}
//if user using app and push notification comes
if (data.additionalData.foreground) {
if (data.message) {
let toast = this.toastCtrl.create({
message: data.message,
duration: 3000,
position: 'top'
});
toast.present();
}
}
});
1 Like
Thanks but I still don’t get some a toast will help me redirect the user to a specific view after he/she clicks on a notification? Should this be done in the backend altogether?
To redirect, just replace the toast (or the this.events.publish()) with normal navigation:
nav.setRoot(MyForm):
or
nav.push(MyForm);
1 Like