View Full Version : Need help deciding which course to take for offline storage

29 Nov 2011, 9:46 AM

i am building a small app in which i want it to remember some user data and update data as well, it needs to run on android and ios. before i start devising ways of tackling this i thought i'd ask because there must be people around that have done the same and came up with something better than i can think of.

when an order is sent i want the app to remember the name, address, etc of where the customer wants it to be sent, so next time the app is run, it will pre-populate the form field with those values. and also allow it to store more than one address, so the user can select from those in the app.
i was looking into localStorage, but that only allows key/value pairs. so now i am thinking of imploding all the form fields into a string and put that into the localStorage. is this a good way of handling it?

the app comes with a file menu.json which holds all the menu items that is used in a treeStore list. i want the file to be able to check online for a newer version and if available, download and use that instead. so there always is an offline version so the app can be used offline. i was thinking of storing the new version on the sd card, but how would that work in ios? giving the user the ablility to use the app offline may be stupid though, since they need to be online to actually send the order. so if there is no nice solution to this, i could always only allow the app to be used online and then i can just get the newest menu.json from the server.

hoping for some guidance...

29 Nov 2011, 1:22 PM
Just use a Model with the fields Array and using the localstorage proxy. This will save a single record to localstorage and manage it for you.

1 Dec 2011, 2:56 AM
yes, i finally got it working-ish. i started out with localstorage, but couldn't get it to work, tried a lot of things and after reading the documentation thought localstorage was only good for key/value as in 1 key, 1 value, not arrays. After your reply i searched again and ended up at Drew Neil's Working with Forms screencast and followed it to the letter and now it is working-ish.

Thanks for the reply.