Caleb Lewis
Caleb Lewis

Reputation: 543

Using plugins with cordova/ionic framework

I'm trying to use this plugin so that I can send local notifications on ios, however, whenever i try to install it with their instructions (cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git && cordova prepare), when I load it up on the emulator and try to test it, it doesn't work. When I do:
alert(window.plugin)
I get an undefined. I should get something like [object Object]. This makes me think that the plugin is somehow not installed correctly or something. Uninstalling and reinstalling does not work. Is there another step somewhere to get in order to use the plugin?

Upvotes: 0

Views: 288

Answers (1)

Jesper We
Jesper We

Reputation: 6097

window.plugin will only exist when running on a device. It does not work in simulated environments.

Also, to make your life easier, I would suggest checking out http://ngcordova.com, which takes care of installation and interfacing within ionic for a whole bunch of useful plugins, including local and push notifications.

Upvotes: 1

Related Questions