What I've learned while developing with Cordova, Ionic, AngularJS and everything else I use to build mobile apps for Android and iOS.
Sunday, March 2, 2014
PhoneGap navigator.notification 'prompt' is undefined
I was using 3 plugins (Media, Device, Notification) and Notification was the only one NOT working. Notification also happened after device was ready (I could play media and get device info, then try notification and nothing).
The issue I had was with the way the Phonegap CLI was adding plugins.
There was no entry in www/corodova_plugins.js for Notifications, but there was for Media and Device
There was no SRC in android/src/org/apache/cordova for Notification, but there was for Media and Device.
There was no JS src in www/plugins for dialogs, but there was for media and device.
Check those locations to see if you have the Notifications info.
I tried adding the plugin several times with various commands. config.xml DID include:
<feature name="Notification">
<param name="android-package" value="org.apache.cordova.dialogs.Notification" />
</feature>
{PROJECT.DIR}/plugins DID have dialogs as well as media and device SRC.
WARNING: running "phonegap build android" would place the correct source in the folders mentioned about, but it WIPES OUT all of your project src in assets/www taking it back to the default.
My remedy: Create a brand new skeleton project, add the plugins you need, do a build for the platform you need, then compare the source between your skeleton Phonegap app and your Real app to see the differences.
Only way I can see now to fix this as it appears that the PhoneGap CLI is "broken" because I don't believe it is adding plugins correctly to an already existing app.
Subscribe to:
Posts (Atom)