내 안드로이드 응용 프로그램을 Cordova 2.5로 업데이트하고 에뮬레이터에서 아름답게 작동하지만 내 HTC 욕망에 문제가 발생했습니다. 나는 그러나안드로이드에서 Cordova 2.5의 openDatabase에 대한 하드웨어 전용 '정의되지 않은'데이터베이스 오류 - 첫 번째 시도에만 해당
db = window.openDatabase("ProblemDirectoryDB", "1.0", "PhoneGap Demo", 100000);
을하려고 할 때 내가 같은 페이지를 두 번 여는 경우, 그것은 잘 작동하고부터, 심지어 강제 정지하고 다시 시작 후에는 '정의되지 않은', 데이타베이스 오류가 발생하도록. 응용 프로그램의 데이터를 삭제하여 오류를 다시 만들 수 있습니다. 관련 코드는 다음과 같습니다. 어떤 도움이나 생각이라도 매우 감사하게 받아 들였습니다.
var db;
var dbCreated = false;
function onBodyLoad(){
$.mobile.loadingMessageTextVisible = true;
$.mobile.loadingMessage = "Loading...";
$.mobile.showPageLoadingMsg();
if (!window.device){
document.addEventListener("deviceready", onDeviceReady, false);
}
else {
onDeviceReady();
}
}
function onDeviceReady() {
db = window.openDatabase("ProblemDirectoryDB", "1.0", "PhoneGap Demo", 100000);
if (dbCreated){
db.transaction(getProblems, read_transaction_error);
}
else{
db.transaction(populateDB, create_transaction_error, populateDB_success);
}
navigator.splashscreen.hide();
}
function populateDB_success() {
dbCreated = true;
db.transaction(getProblems, transaction_error);
}
function create_transaction_error(tx, error) {
$.mobile.hidePageLoadingMsg();
alert("Create Database Error: " + error);
}