Notification toggle

Hi, I don't seem to find any standard way to actually turn off the notification services for a user, as most of the applications, I have a toggle in application settings which will toggle between allowing notification and disallowing it.

therefore, we need an API to do just the thing, however, I have not found anything in any documentation nor the forum or other de-bugging websites which leads to the conclusion that there might not be an API with this functionality.

I also thought about tricking the server by clearing token:

[CountlyPushNotifications.sharedInstance clearToken];

But as you point out what it does:

  • Clears push notification token on Countly Server for current device ID.

  • @discussion Can be used to clear push notification token for current device ID, before the current user logs out and device ID changes, without waiting for the app to be restarted.

I can't help but imagine there will be numerous bugs as that function is not implemented to be used for such functionality.
What I ask is if there is a standard way to toggle notification from the client side, or Countly server side and if there aren't, is there a tested trick that would allow me to get the same result without any bugs.
Thank you.

Hi @Mahan,

Could you clarify what the issue is about? That feature is specifically designed for a case of turning off push for the current user. I guess you had some issues with it? Then could you list the "numerous bugs"?

@erkanyildiz could you also take a look?

Hi @artem I think that was a bug on my application because I tried it again and seems like it works perfectly.
The bugs were, I had no trouble changing the state of notifications but no change was made on the server.
Feel free to remove this post or ask me to do so, however, I think this post and your answer could clear (if any) confusions and are helpful and therefore should remain.