我正在将 Phonegap 2.7 应用程序移植到 Phonegap 3。该应用程序是托管的,因此 phonegap 加载外部 url 而不是本地 html。这个托管的 webapp 加载cordoba.js
,但是我无法使用来自托管 webapp 的插件,例如启动画面和通知:
navigator.splashscreen.hide();
// Uncaught TypeError: Cannot call method 'hide' of undefined
navigator.notification.vibrate(500);
// Uncaught TypeError: Cannot call method 'vibrate' of undefined
托管应用程序需要与我创建 Phonegap 3 项目时包含的相同的 Cordova 文件。为什么我无法使用此 API?这在 Phonegap 2.7 上运行良好。
更新:事件被正确触发:
document.addEventListener('deviceready', callback, false);
callback
被正确调用,因此已经存在某种科尔多瓦交互。问题似乎是插件。