Phonegap如何在安卓上保存永久数据[英] Phonegap how to save permanent data on android

本文是小编为大家收集整理的关于Phonegap如何在安卓上保存永久数据的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在寻找一种使用 PhoneGap 永久保存数据的方法.

  1. LocalStorage
  2. 文件 I/O
  3. ?

我听说 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

本文地址:https://www.itbaoku.cn/post/597584.html

问题描述

I'm looking for a method to save data permanently using PhoneGap.

  1. LocalStorage
  2. File I/O
  3. ?

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