Reputation: 27
I'm currently building an Application with PhoneGap(3.3). When i try to get the API to work i always get the error:
for example: "Cannot call method 'vibrate' of undefined
What i did:
phonegap create appname com.myname.appname appname
phonegap local build android
phonegap plugin add XXXXXX plugin path (gave me response that plugin was installed correctly)
modified my index.html to call vibrate when the device is loaded
function onDeviceReady() {
navigator.notification.vibrate(2000);
}
But i still cant get the phonegap api to work since i get the error the method is not defined. Anybody got a solution for this or am i just plain dumb.
Regards
Upvotes: 0
Views: 276
Reputation: 879
Before deploying my code to native platforms, I often don't include links to the cordova.js and cordova_plugins.js. Make sure you've added those in before you prepare your code. It's an easy step to miss.
Upvotes: 0
Reputation: 6029
I would double check that you have installed both notification plugins:
cordova plugin add org.apache.cordova.dialogs
cordova plugin add org.apache.cordova.vibration
AND make sure that after you install the plugins you run the build command again:
phonegap local build android
Upvotes: 1