Reputation: 25
I have implemented push notifications to a Worklight application. One of the requirements is to display a message if the user has disabled the push notifications for the application at the OS level.
Is there a way to detect this change? The Worklight's method isPushEnabled: Checks whether push notification is supported.Returns true if the IBM® Worklight® JavaScript API supports push notifications in the current environment.
Even if I disabled push for the AMS App, this method still returns true.
I also searched a solution at the Cordova level but no luck so far.
Thank you
Upvotes: 0
Views: 339
Reputation: 2132
If the users subscribe and unsubscribe on login/logout you could always use the API WL.Client.Push.isSubscribed(alias) to check if the current user is subscribed. If the user is not subscribed you could pop up an alert asking them to subscribe as well as informing them "If you have disabled Push Notification for this application you can re-enable push by going to Settings-> Notification-> AppName".
Without writing Native code I do not know if it is possible to check if the user has disabled push at the OS level. I have seen some solutions written natively though, for example there is some discussion here for iOS:
Enable/Disable Apple Push Notification from iPhone app?
Upvotes: 3