Reputation: 66
I have created an app that receives my notifications from PushWoosh. I want to create a page where the user can stop/start these notifications. It will be like a settings page.
Can this be done? Can you show me a quick example code?
Thanks
Upvotes: 0
Views: 388
Reputation: 21
Of course it is possible! Moreover, there are different ways to do so.
First of all, please note that there is the unregisterDevice API method, which deletes the push token of a device from Pushwoosh database. You can modify the SDK you are using and check whether your user enabled push notifications from your application, and call unregisterDevice in case he/she didn't.
Second, you can use the Tags feature. By calling setTags method in your application, you can set a Tag value of the device. Later, you can use it for targeting.
For instance, you can send a message only to users who enabled notifications by adding the following line to the createMessage request:
"conditions":[["Enable_pushes","EQ","Yes"]],
Please note that Tags is a Premium-level feature. If you would like to test it, you can get in touch with Pushwoosh support team and get a free trial period.
Upvotes: 1