对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"
我已经完成了这里概述的完整安装和项目生成过程: phonegap.pbworks/Getting-started-with-Android-PhoneGap-inEclipse
I've gone through the full installation and project generation process outlined here: phonegap.pbworks/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 obj
发布评论