Software Archive
Read-only legacy content

indexeddb

Don_R_
Beginner
947 Views

jQuery Mobile app using indexeddb works in Chrome and XDK emulator.  However when it is tested on a device (Samsung Galaxy S5) the database is created but not the objectstores.  Changing the version number does not fire onupgrade.  Any help is appreciated.

0 Kudos
5 Replies
Barry_Johnson
New Contributor I
947 Views

Are you using Crosswalk on the device? If not you may want to give it a try or provide some additional detail on your OS version since it won't have a standardized web container.

Also, to clarify your comment, you are saying the DB was created but not the objectstores, and that you aren't getting onupgrade events. But you are saying that the object returned by IDBEngine.open fires onsuccess, as you'd expect?

I have had excellent luck with IDB on Android, iOS is another matter, but I use a shim to WebSQL for that.

0 Kudos
Don_R_
Beginner
947 Views

 Thank you for the comment.  I am not using Crosswalk, but will give it a try.

0 Kudos
PaulF_IntelCorp
Employee
947 Views

Another solution to consider is using this plugin as an alternative: https://github.com/brodysoft/Cordova-SQLitePlugin

0 Kudos
Bruce_C_
Beginner
947 Views

I wonder if anybody has a working IndexedDB installation working?  We have tried with a successful 3rd pty plugin import, and compiled with Crosswalk.  We can get a connection, but no data in the emulator nor in a test smartphone.  We DO get the data in a browser launched from the html file directly.

 

0 Kudos
Jon_G_
Beginner
947 Views

Hi there

i am having the same problem with indexeddb. objectstore is not being created, the database gets created but after i validate the form elements on the app page, i tried to write to the database but it fails.

i used

// collection of form elements
 var name = document.getElementById("name").value

//validate form elements
if (name === null || name === "") {
        navigator.notification.alert("name must be filled out", , "Error: Details incomplete.", "close");
    } 
else {
        
        saveVehRecord();
            return;
        }       
        navigator.notification.alert("save details failed!!!"); 

//write to database store

function (){
var Record = new Record(name);
     navigator.notification.alert("Record prepared for write");
     
     var transaction = database.transaction("NameData", "readwrite");
     var objectStore = transaction.objectStore("NameData");
     
     var request = objectStore.put(Record);
     request.onerror = function(evt){
         navigator.notification.alert("Error: Database connection failed.");
     };
     request.onsuccess = function(evt) {
         navigator.notification.alert("Success: name record added into database");

    };
}

the above is the implementation. I created the database with a header js file and the codes for the objectstore was also there. Those codes does fire and the database is created but the elements from the form never get written to store. instead it give me an error

TypeError: Record is undefined.

Please help. I am just a newbie trying to code with intel XDK.

thanks

0 Kudos
Reply