navigator.notification。* failed“navigator.notification [undefined] is not an object”。 [英] navigator.notification.* fails "navigator.notification [undefined] is not an object"

查看:212
本文介绍了navigator.notification。* failed“navigator.notification [undefined] is not an object”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对PhoneGap navigator.notification方法的任何调用都失败,并显示消息表达式结果navigator.notification [undefined]不是对象

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

我已经完成了这里概述的完整安装和项目生成过程: http://phonegap.pbworks.com/Getting-started-with-Android-PhoneGap-inEclipse

I've gone through the full installation and project generation process outlined here: http://phonegap.pbworks.com/Getting-started-with-Android-PhoneGap-in-Eclipse

...并且从Eclipse运行时应用程序运行正常,除非尝试访问导航器对象。以下是抛出错误的JavaScript代码:

...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认为cordova * .js

I think the cordova*.js

(src =cordova-2.1.0.js)与您项目的www文件夹中的不同。我有同样的问题&更改Index.html页面中的引用解决了我的问题。

(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.

请参阅此链接: phonegap-sample-application-for-android-does-not-work

这篇关于navigator.notification。* failed“navigator.notification [undefined] is not an object”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆