Reputation: 1747
I trying to use PhoneGap for developing a simple app that has some kind of DB with a couple of values and the data is retrieved from there and showed. The thing is, I a newbie in this. I know there is a plugin named storage but i just can't find anything that enlight me enough for doing this. Can anyone help me or tell me where can I get a good tutorial for this?
Upvotes: 0
Views: 303
Reputation: 23
You can find Phonegap Development storage API.
It's very useful for beginners.
Upvotes: 2
Reputation: 2815
I would like to tell you about two storage mechanisms. First one is a SQL database. Second one is localStorage.
SQL organises your data in a good way, local storage may be your "cache", some kind of qiuck access memory. Both are very usefull. Both work on multiple platforms.
Here are some examples showing storing and accessing data in local storage:
window.localStorage.setItem("key", "value");
var value = window.localStorage.getItem("key");
I think you will easily find how to access database. I am sure you will find this interesting:
http://docs.phonegap.com/en/2.0.0/cordova_storage_storage.md.html#Storage
Upvotes: 1
Reputation: 5526
If your values are small and simple, then you can simply use the window.localstorage
.
In your javascript:
To create or update:
window.localStorage.setItem(name,value)
To delete:
window.localStorage.removeItem(name)
To get:
window.localStorage.getItem(name)
Upvotes: 0