Pushy.me: How to unregister from push notification in react native?

402 Views Asked by At

I have integrated Pushy.me in my react-native app for push notifications, I followed the docs to set things up and everything seems fine.

My question is simple, how can I unregister a device token after registering it? In the documentation, it says to call pushy.unregister(Context ctx) for android, but I can't seem to find anything for react-native If anyone knows how to do it I'll be really grateful.

Also If anyone knows of any links that contain the methods that are available to use in the Pushy SDK for React Native, I've been doing some tests and found that some methods mentioned in the android SDK section work also on react-native but not all of them, and I can't seem to figure out what parameters to pass to such methods.

I really appreciate any help you can provide.

1

There are 1 best solutions below

1
On

If your intention in unregistering the device is for that device to stop receiving notifications from Pushy (and stop it from being counted as an active device in the next monthly periods), simply call Pushy.toggleNotifications() as follows in your RN JS code:

Pushy.toggleNotifications(false);

This will effectively prevent being billed for the device in the next billing periods, and will prevent notifications from coming in. When you'd like the device to receive notifications again, call the method again, passing in true:

Pushy.toggleNotifications(true);

Full disclosure: I work at Pushy.