开发者

navigator.notification.* fails "navigator.notification [undefined] is not an object"

开发者 https://www.devze.com 2023-01-03 01:35 出处:网络
Any call to a PhoneGap navigator.notification method is failing with the message \"Result of expression navigator.notification [undefined] is not an object\"

Any call to a PhoneGap navigator.notification method is failing with the message "Result of expression navigator.notification [undefined] is not an object"

I've gone through the full installation and project generation process outlined here: http://p开发者_运维问答honegap.pbworks.com/Getting-started-with-Android-PhoneGap-in-Eclipse

...and the application works fine when run from Eclipse, except until trying to access the navigator object. Here is the JavaScript code that is throwing the error:

var beep = function() {
    try {
        if (navigator != null) {
            navigator.notification.beep(2);
        }
    } catch (e) {
        alert("Beep failed: " + e.message);
    }
}  


I think the cordova*.js

(src="cordova-2.1.0.js") is not same as in the www folder of your project. I had this same problem & changing the reference in Index.html page solved my problem.

See this link : phonegap-sample-application-for-android-does-not-work

0

精彩评论

暂无评论...
验证码 换一张
取 消