How to unsubscribe to OneSignal Programmatically in android studio

Viewed 6472

I have made a news app that send the users oneSignal notification and works fine ,but i have a problem with making the user controlling whether receiving the notification or not but i can't find how to make unsubscribe to OneSignal Programmatically and if the user do that by pressing a button ,he will no longer receive any notification , any one can help please am still beginner in android studio .

2 Answers

On OneSignal 4.0.0, setSubscription(false) was replaced with

OneSignal.disablePush(true)
Related