Skip to content Skip to sidebar Skip to footer

Phonegap Doesn't Show Alert

why phonegap doesn't show alert notification ? (running on iPhone 5.1.1 , phonegap phonegap-2.1.0-0-g26d211b, mountain lion 10.8.2, xcode 4.4.1)

Solution 1:

Because you are trying to show an alert before phonegap/cordova framework is loaded.

$(document).ready(function(){ is not going to help you here, you must use this event to check if phonegap is successfully loaded:

document.addEventListener("deviceReady", deviceReady, false);

functiondeviceReady() {
    // Now safe to use the PhoneGap API
}

More about this event: http://docs.phonegap.com/en/1.0.0/phonegap_events_events.md.html

PhoneGap consists of two code bases: native and JavaScript. While the native code is loading, a custom loading image is displayed. However, JavaScript is only loaded once the DOM loads. This means your web application could, potentially, call a PhoneGap JavaScript function before it is loaded.

Post a Comment for "Phonegap Doesn't Show Alert"