Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistent data for PhoneGap apps

EDIT#2 - The replies until now (after 2 days) are personal opinions and preferences and not an analysis of the various options that an offline-phoneGap app has to store simple data easily across all relevant devices. As such I haven't accepted any answer, but I am following this question.

I am a little confused about which format of persistent data I should be looking into for a PhoneGap web app I'm building. I've been researching this but things are not clear given my mediocre requirements.

The app is an educational app with about 100 or so multiple choice questions and some memorization games attached.

The app once downloaded can remain offline.

It is for all phonegap supported devices.

The only data that I want to read and write is the user's performance, number of times wrong in total, per card etc and any high scores for games.

This is all very basic information and could be held in very simple js objects.

I would like it to be a fairly simple solution and very easy to maintain/repeat.

What would be my best option? The phonegap file api? json/lawnchair? local-storage? cookies? Would there be a way to 'update' the app and keep it as an object in the javascript? websql? sqilite? Storage API?

Some of these seem overkill.

EDIT Are there differences in devices and I should do some device detection and use different technologies?

like image 764
EnglishAdam Avatar asked Nov 25 '12 19:11

EnglishAdam


1 Answers

I personally like localStorage. It's straight forward and works great for most situations.

If you are just recording the data you mention above, localStorage would be perfect. I would just seralise your data objects by turning them into a string using say JSON.stringify(), then when pulling it back in use JSON.parse() to turn it back into a useable JS object.

like image 83
Devgeeks Avatar answered Oct 14 '22 06:10

Devgeeks