OneSignal / react-onesignal

React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
74 stars 23 forks source link

[Question]: turn off notifications on certain device if logout #135

Open captain-avocado opened 5 months ago

captain-avocado commented 5 months ago

How can we help?

I have several apps connected to one OneSignal account: Android, iOS and Web. If the user logout, for example, from web app, I want him to continue receiving notifications on Android and iOS (if he's still logged in there). But at the same time user don't need notifications from Web app. How can I achive this? Should I just use logOut method?

jkasten2 commented 5 months ago

@captain-avocado I would recommend using OneSignal.logout() as you noted. Logout removes the push subscription from User that was logged in.

If you also want the browser to stop receiving all OneSignal notifications, then you will also need to disable them with OneSignal.User.PushSubscription.optOut().