[英]“deviceready has not fired after 5 seconds” cordova 3.5.0-0.2.1
I am developing a hybrid app with html5 cordova. 我正在使用html5 cordova开发混合应用程序。 I have 3 html pages.
我有3个html页面。 I use localStorage and SQLite Plugin.
我使用localStorage和SQLite插件。 I navigate between those pages.
我在这些页面之间导航。 But, when I move from one page to another, cordova features become useless.
但是,当我从一页移动到另一页时,cordova功能变得毫无用处。
my login.html page: 我的login.html页面:
Document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({
name : "OZEGE",
bgType : 1
});
//some transactions
}
function Login(){
// my login authorization
}
and after the authorization, I move my other page with this code line; 授权后,我用此代码行移动另一页;
window.location = "experInfos.html";
experInfos.html:` experInfos.html:`
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady() {
document.getElementById("devamButonu").disabled = true;
var db = window.sqlitePlugin.openDatabase({
name : "OZEGE",
bgType : 1
});
//populate dropdown
populateMensei(db);
}
` `
when the second page opens, console shows; 当第二页打开时,控制台显示;
deviceready has not fired after 5 seconds. (01:40:11:905)
at www/cordova.js:1154
I couldnt populate my drop down list. 我无法填充我的下拉列表。 it shows:
表明:
SQLitePlugin openargs: {"name":"OZEGE","bgType":1} (02:08:08:610)
at file:///android_asset/www/plugins/org.pgsqlite/www/SQLitePlugin.js:8
but nothing happens. 但什么也没发生。 Why cannot I use device ready on second page ?
为什么不能在第二页上使用准备就绪的设备? Because of the config.xml ?
因为config.xml吗?
I change the way of navigation. 我改变了导航方式。 I put all the html files in one page and I just change the visibility of views.
我将所有html文件放在一页中,而只是更改视图的可见性。 It works and there is no problem with this situation now
它有效,现在这种情况没有问题
Something else I found, try adding a sdcard to your emulator 我发现了其他东西,请尝试将sdcard添加到模拟器中
I found my initial error was the file plugin was not being allowed to access a file space, this was because it didn't exist in the emulator, I added an external card to the emulator definition and hey presto it worked 我发现我的最初错误是不允许文件插件访问文件空间,这是因为该插件在模拟器中不存在,我在模拟器定义中添加了一个外部卡,嘿,它能正常工作
I managed to get navigation to work by concatenating all my stylesheets to a single file, so I'm guessing this has to do with load time or number of file requests etc. in the page you are navigating to. 我设法通过将所有样式表连接到一个文件来使导航正常工作,所以我猜想这与浏览页面中的加载时间或文件请求数等有关。 @amenthes I hope that works for you too.
@amenthes我希望对您也有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.