I need to run unregister on login, to prevent receiveing push notification assigned to previous user.
As I know GCM chains all registrationID's, and if I call "unregister" it should break that chain and when I register again GCM will create new one registrationID not related to previous.
For example:
I login with user1 and send to him notification, it works fine.
Then I logout and login with user2, here in unregister success calback I call register function to get new registrationId for user2.
And when I send notification to user1 (whose regID should become invalid after unregister) anyway my device receives notification.
Could you please advice? Maybe I'm doing something wrong.
I know that it's not recommended to user unregister method.
But how can I check if notification is not related to current client?
I have only "onMessage" callback, and is there a way to catch notification event before it appears
in notification center? I can send whatever data to identify is current notification related to this client. And also how can I reject this notification if it's not related to this user?
Here is the code sample with unregistration usage:
function registerGcmNotifications (senderId) {
var pushNotification = window.plugins.pushNotification;
Hello,
I need to run unregister on login, to prevent receiveing push notification assigned to previous user.
As I know GCM chains all registrationID's, and if I call "unregister" it should break that chain and when I register again GCM will create new one registrationID not related to previous.
For example:
I login with user1 and send to him notification, it works fine. Then I logout and login with user2, here in unregister success calback I call register function to get new registrationId for user2. And when I send notification to user1 (whose regID should become invalid after unregister) anyway my device receives notification.
Could you please advice? Maybe I'm doing something wrong.
I know that it's not recommended to user unregister method.
But how can I check if notification is not related to current client? I have only "onMessage" callback, and is there a way to catch notification event before it appears in notification center? I can send whatever data to identify is current notification related to this client. And also how can I reject this notification if it's not related to this user?
Here is the code sample with unregistration usage:
function registerGcmNotifications (senderId) { var pushNotification = window.plugins.pushNotification;
}