mobiledev
Posts: 0
Joined: Tue Aug 13, 2013 7:58 pm

Storing database locally on device and not on the cloud or database service of appery

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Storing database locally on device and not on the cloud or database service of appery

Hi,

You can use localStorage, websql, files for storing data.

Walter Lee6162535
Posts: 0
Joined: Wed Aug 21, 2013 5:49 am

Storing database locally on device and not on the cloud or database service of appery

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.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Storing database locally on device and not on the cloud or database service of appery

Hi,

Did you test this in the browser or on the device?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Storing database locally on device and not on the cloud or database service of appery

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...

Walter Lee6162535
Posts: 0
Joined: Wed Aug 21, 2013 5:49 am

Storing database locally on device and not on the cloud or database service of appery

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 ?

Walter Lee6162535
Posts: 0
Joined: Wed Aug 21, 2013 5:49 am

Storing database locally on device and not on the cloud or database service of appery

Hi, Igor,

tks a lot !
It works now, I forgot to getItem on loading the page.

Return to “Issues”