I've been using the PushWoosh service and Cordova Push Notifications plugin for Kids In Touch. However, there's alway sbeen something that I could not fix. Really it was a combination of things.
Plugin Callsback Before User Answer Prompt
When iOS prompts a user to accept or decline push notifications, the PushWoosh Cordova plugin should be get a success or failure callback. Unfortunately, the current release of the plugin ALWAYS executes the failure callback even before the user makes their decision.
Plugin Requires An App Reload to Get Push Status
The other problem has been that the plugin always reports that notifications are disabled. Example Response:
{"type":"0","pushBadge":"0","pushSound":"0","enabled":"0","deviceToken":"7d4.....8a6b5","pushAlert":"0"}
In order to get the real push status, the user has been forced to completely close the app and then reopen. After that, you will get :
{"type":"7","pushBadge":"1","pushSound":"1","enabled":"1","deviceToken":"7d4.....8a6b5","pushAlert":"1"}
Needless to say, those two bugs are less than a great experience for developers and users.
Fix the Problem
Today, I noticed there is a fix for this problem. Unfortunately, the current build of the app does not have this fix. To get this problem resolved you have to do the following :
WARNING : Use at your own risk. PushWoosh has not made this part of the official release.
// Ugh.. I hate this but it's the only way to get the plugin integrated properly
> cordova platform remove ios
> cordova plugins remove com.pushwoosh.plugins.pushwoosh
// Now, the important part. You're adding the plugin from specific commit.
> cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin#c4a9e3313b0ae919540ccd7eb7110344174e53d1
Tada! Now, when you call the registerDevice()
method, the callback does not execute until AFTER the user has made their choice. This means, you get the correct notification status in the callback.
Let's hope PushWoosh integrates this fix into the releases.
New Feature Request
I also would really like for the plugin to allow the developer to query the status of push notifications. Right now, it seems the only way to get this information is with the registerDevice
method.
If anyone has any feedback, corrections, or questions, please let me know on Twitter.