Hi,
I read the documentation carefully but i didn't find a method to unregister from push notification.
How to achieve similar operation?!
Thank you.
+1
I tried to use the unregister() method but it does not seem to work because i was still receiving notification push.
PushNotification.cancelLocalNotifications(), or cancelAllLocalNotifications should work.
Testing this with a button that sends local notifications and a button that calls the unregister method, this appears to work for me. @theohdv , do you have more details about your case?
(Note that I don't have any responsibility for this project, but as a user of this library鈥攚hich is working great for me so far; thanks to all contribs!鈥擨'm just curious about cases where unregister may not work as expected.)
Okay maybe it is because this method is only for local notifications. And to prevent your application to receive push notifications is a server side job I assume (It is how i managed that).
Finally I am able unsubscribe from Remote Notification 馃槈
Refer to : surialabs/react-native-push-notification@39d7adb
A scenario to subscribe and unsubscribe is to signIn & signOut
requestPermissions() (So a new deviceToken is generated & u have to update the token to your backend)abandonPermissions() (The token will be invalidated & your device will not receive any remote notification sending through that deviceToken)@kyaroru Thank you for the solution it works fine on iOS
But, I cant unsubscribe on android, I still receive notification after
PushNotification.requestPermissions()
can you help?
u have to fire PushNotification.abandonPermission() using the code that I committed
Thank you @kyaroru for the reply.
./gradlew clean, but I still receive notification on Android after PushNotification.abandonPermission()have you link the method abandonPermission in the index.android.js? alternatively, you can put console.log and see whether the method is invoked correctly
@kyaroru Can you make a PR with this feature? 馃槄
@YahiaJabeur Maybe try PushNotification.abandonPermissions() instead of PushNotification.abandonPermission()
@kyaroru Can you make a PR with this feature? 馃槄
hmm.. will do in the near future 馃槢
Ran into this issue today on Android, neither abandonPermissions nor unregister releases an app from all previously subscribed topics/notifications
Hi, I think this issue is solved in recent release. Feel free to reopen if it's not the case.
Most helpful comment
Finally I am able unsubscribe from Remote Notification 馃槈
Refer to : surialabs/react-native-push-notification@39d7adb
A scenario to subscribe and unsubscribe is to signIn & signOut
requestPermissions()(So a new deviceToken is generated & u have to update the token to your backend)abandonPermissions()(The token will be invalidated & your device will not receive any remote notification sending through that deviceToken)