I have a problem with navigator.notification.confirm, it seems the plugin is not properly loaded and I have no idea why.
I am using eclipse to deploy the app on a emulator, and I keep getting the message:
02-26
15:59:59.933: E/Web Console(1368): Uncaught TypeError: Cannot call
method 'confirm' of undefined at file:///android_asset/www/index.html:53
when trying to call navigator.notification.confirm. The appropriate code is here:
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
function onDeviceReady() {
initialize();
}
function initialize() {
askForUpdateDatabase();
}
function askForUpdateDatabase() {
navigator.notification.confirm("Der Datenbestand ist veraltet. Soll eine neue Version heruntergeladen werden?", askedForUpdateDatabase, "Update?", ["Ja", "Nein"]);
}
function askedForUpdateDatabase(select) {
if (select==1) updateDatabase();
}
function updateDatabase() {
alert("Aktualisiere Datenbank...");
}
The important parts of the config.xml:
<feature name="Geolocation">
<param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />
</feature>
<feature name="Vibration">
<param name="android-package" value="org.apache.cordova.vibration.Vibration" />
</feature>
<feature name="Notification">
<param name="android-package" value="org.apache.cordova.dialogs.Notification" />
</feature>
And the output of the installed phonegap plugins:
D:\apps\MYAPP>phonegap plugin list
[phonegap] org.apache.cordova.dialogs
[phonegap] org.apache.cordova.geolocation
[phonegap] org.apache.cordova.vibration
D:\apps\MYAPP>phonegap version
3.3.0-0.19.6
The
geolocation plugin works perfectly, but I cannot fix the dialogues. It
also won't work when removing it from the phonegap-ready event and
calling it directly on a button.
Does anyone have an idea what the problem is?
Thanks in advance