Wizcorp / phonegap-plugin-localNotifications

PhoneGap plugin for providing native local notification system to JavaScript.
MIT License
38 stars 29 forks source link

cancelAll() function not working #29

Open simongcx opened 9 years ago

simongcx commented 9 years ago

The cancelAll() function does not appear to be working on Android 4.4.4 with a Cordova 3.5.1 app built in Intel XDK using release 2.1.0 of this plugin.

I have added callbacks to the cancelAll() function in the javascript interface file and have observed the callbackContext failure callback being called. I have briefly tried to see error messages in adb, but to no avail.

I note that in the AlarmHelper class, cancelAlarm method there is not logging within the error handler nor is there communication of the error details back into the cordova/js. My understanding is that this could be achieved with something like the following, but I am not a Java developer so not 100% on this:

PluginResult result = new PluginResult(PluginResult.Status.ERROR, data);
result.setKeepCallback(false);
callbackContext.sendPluginResult(result);

On a related subject I also noticed that the unpersistAlarmAll(); call within the LocalNotification class occurs before the AlarmHelper is called. As such, it would be possible for the data to be cleared, without a successful removal of the notification.