Page 1 of 1
Storing database locally on device and not on the cloud or database service of appery
Posted: Tue Aug 13, 2013 8:01 pm
by mobiledev
How do I store dataentered in the app just on the device and not on appery cloud database?
I would like to have user enter some data in the app and leave it on that specific app instance on the local phone.
I understand that If user uninstalls the app, they lose all the data.
Storing database locally on device and not on the cloud or database service of appery
Posted: Tue Aug 13, 2013 8:59 pm
by Kateryna Grynko
Hi,
You can use localStorage, websql, files for storing data.
Storing database locally on device and not on the cloud or database service of appery
Posted: Sat Sep 14, 2013 7:00 pm
by Walter Lee6162535
Any pointers to know the details ?
e.g. where is the localStorage ? in phone memory ? Will not lose it after a restart ?
how to write to files ?
I used
localStorage.setItem('text', input);
but it somehow lost the data after a page move or restart.
Storing database locally on device and not on the cloud or database service of appery
Posted: Sat Sep 14, 2013 8:11 pm
by Igor
Hi,
Did you test this in the browser or on the device?
Storing database locally on device and not on the cloud or database service of appery
Posted: Sat Sep 14, 2013 9:09 pm
by maxkatz
Local storage is standard browser storage and API. Data you save will persist between navigation as well as closing/opening the browser.
https://developer.mozilla.org/en-US/d...
It will get deleted if you clear the storage or over write a key/value.
You can use Chrome Dev. Tools to view current local storage content:
http://docs.appery.io/documentation/d...
Storing database locally on device and not on the cloud or database service of appery
Posted: Sat Sep 14, 2013 11:24 pm
by Walter Lee6162535
This Developer Tools is very helpful in debugging !
Thanks !
Q - if I have
if (!window.localStorage.mytext) {
window.localStoarge.setItem('mytext','HELP ! HELP !');
}
console.info('mytext:' + localStorage.mytext);
where to see the console.info output ?
Storing database locally on device and not on the cloud or database service of appery
Posted: Sat Sep 14, 2013 11:25 pm
by Walter Lee6162535
Hi, Igor,
tks a lot !
It works now, I forgot to getItem on loading the page.
Storing database locally on device and not on the cloud or database service of appery
Posted: Sat Sep 14, 2013 11:52 pm
by maxkatz