I’ve created a web application with an IndexedDB. After putting some data in it, I closed the app (long pressing the home button/pressing back in the main page). When going back to my app, the database is opened, but no data shows up. When checking the inspector I found out that this time the indexedDB tab was empty.
After quitting app & starting it back up: http://i.imgur.com/FotUk4d.png (NOTE: It stays like this, even when adding data)
Open IndexedDB code:
var dbName = "database";
var dbVersion = 1;
database.indexedDB.open = function() {
var request = indexedDB.open(dbName, dbVersion);
request.onsuccess = function(e) {
console.log("database opened");
var database = e.target.result;
//Do stuff with database
}
request.onupgradeneeded = function(e) {
var database = e.target.result;
try {
if (database.objectStoreNames &&
database.objectStoreNames.contains("entry"){
db.deleteObjectStore("entry");
}
}
catch (err) {
console.log("got err in objectStoreNames:" + err);
}
var store = db.createObjectStore("entry",{keyPath: "timestamp"});
console.log("-- onupgradeneeded store:"+ JSON.stringify(store));
}
request.onfailure = function(e) {
console.error("could not open database: "+e);
}
request.onerror = function(e) {
console.error("Err: "+e);
}
};
In the logs I get “database opened”, so everything should have gone alright, but I do not see any data. I can’t find a solution anywhere, so I figured I’d try here. Does anyone know what I might be doing wrong? Thanks in advance!
IndexedDB not retrieving data/re-opening
I’ve created a web application with an IndexedDB. After putting some data in it, I closed the app (long pressing the home button/pressing back in the main page). When going back to my app, the database is opened, but no data shows up. When checking the inspector I found out that this time the indexedDB tab was empty.
After first startup: http://i.imgur.com/z2NKmiH.png
After entering some data: http://i.imgur.com/XQKLieC.png
After quitting app & starting it back up: http://i.imgur.com/FotUk4d.png (NOTE: It stays like this, even when adding data)
Open IndexedDB code:
In the logs I get “database opened”, so everything should have gone alright, but I do not see any data. I can’t find a solution anywhere, so I figured I’d try here. Does anyone know what I might be doing wrong? Thanks in advance!
BY
16 Apr 2025
Tizen Studio
BY
04 Nov 2024
Tizen Studio
BY
02 Apr 2024
Tizen Studio