Reputation: 59
I used to add the https://github.com/katzer/cordova-plugin-local-notifications plugin in order to get local notification on my apps, but since the version 3.5.0 the plugin is not loaded anymore by cordova...
The plugin seems correctly added, since I can see it in the : cordova plugin list
result
In the JS code I got
if(window.plugin && window.plugin.notification){
window.plugin.notification.local.add({ message: 'a msg' });
}
but window. plugin is undefined.
Am I missing something or something changed with the version 3.5.0?
Upvotes: 0
Views: 737
Reputation: 21
There is a surprise here. Whenever you enable a plugin, you have to download the debugger again, and install on the virtual machine / device for it to recognize the plugin. The docs didn't say it. I've just discovered it today.
Upvotes: 0
Reputation: 139
The plugin will be available once the "Device is Ready". Listen the device ready event and then call you alert function.
https://github.com/jonbarlo/cordova-plugin-local-notifications#using-the-plugin
document.addEventListener('deviceready', function () {
// window.plugin.notification.local is now available
}, false);
Upvotes: 2