问题描述
我正在寻找一种使用 PhoneGap 永久保存数据的方法.
- LocalStorage
- 文件 I/O
- ?
我听说 LocalStorage 不是 100% 永久的,而是在小巷的某个地方.
我不太愿意从文件 I/O 开始,因为我需要创建一个包含食谱的数据库,并且它们需要保留.
"数字 3"是我要问的.有什么建议吗?
提前致谢:)
推荐答案
我正在使用本地存储,这是保存已保存数据的最佳解决方案.就像你说的,它不是 100% 永久的.就我而言,仅当您卸载应用程序时才会清除本地存储.使用 Phonegap 查找有关本地存储的更多信息http://docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#localStorage
您可以在以下位置获取有关本地存储的更多信息http://diveintohtml5.info/storage.html
您也可以使用数据库.您可以在以下位置找到相关信息http://docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#openDatabase
问题描述
I'm looking for a method to save data permanently using PhoneGap.
- LocalStorage
- File I/O
- ?
I heard LocalStorage is not 100% permanent, but is somewhere in the alley.
I wouldn't really like to begin with File I/O, because what I need is to create a database with recipes, and they need to stay.
"Number 3" is what I'm asking about. Any suggestions?
Thanks in advance :)
推荐答案
I'm using the localstorage and this is the best solution to keep saved data. Like you said, it isn't 100% permanent. In my case the localstorage is cleared only if you uninstall the app. Find more info about localstorage with Phonegap http://docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#localStorage
You could get more info about localstorage on http://diveintohtml5.info/storage.html
You could use a database as well. You can find info on this at http://docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#openDatabase