6

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 .

hassan emad
  • 73
  • 1
  • 7
  • This suggests its about Android Studio an IDE, rather than Android programming - suggest renaming. Also please provide examples of what you have already tried to make clearer to someone who could help. – Simon Black Aug 06 '17 at 07:53

2 Answers2

15

On OneSignal 4.0.0, setSubscription(false) was replaced with

OneSignal.disablePush(true)
Muz
  • 5,866
  • 3
  • 47
  • 65
12
OneSignal.setSubscription(false);

setSubscription METHOD

You can call this method with false, to opt users out of receiving all notifications through OneSignal.
You can pass true later to opt users back into notifications.

https://documentation.onesignal.com/docs/android-native-sdk#section--setsubscription-

benomatis
  • 5,536
  • 7
  • 36
  • 59
JTeam
  • 1,455
  • 1
  • 11
  • 16