Reputation: 553
I use Pusher Beams for my android app's push notification service. I want to make the app unsubscribe from all Pusher Beams push notification interests upon user's logout. I've tried this:
PushNotifications.unsubscribeAll();
I got no errors, but the notification still appears even when the user has already logged out. I've checked Pusher Beams documentation but there is nothing about unsubscribe
.
As alternative, I'm using this code:
PushNotifications.unsubscribe("interestName");
It works, the only difference is that the latter needs specific interest name that will be unsubscribed.
How can I solve this?
Upvotes: 1
Views: 1328
Reputation: 31
I think you should use
PushNotifications.clearDeviceInterests()
according to the documentation
https://pusher.com/docs/beams/reference/android/#cleardeviceinterests
Upvotes: 0
Reputation: 11
Set<String> subscribes = PushNotifications.getSubscriptions();
for (String sub : subscribes){
PushNotifications.unsubscribe(sub);
}
I did this. Hope it will help you. I also put this code before every subscribe just for case.
Upvotes: 1