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

查看:136
本文介绍了Phonegap如何在Android上保存永久数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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


  1. LocalStorage

  2. 文件I / O


我听说 LocalStorage 不是100%永久,而是在胡同里。

I heard LocalStorage is not 100% permanent, but is somewhere in the alley.

我真的不想从File I / O开始,因为我需要的是用食谱创建一个数据库,他们需要留下。

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是我要问的。任何建议?

"Number 3" is what I'm asking about. Any suggestions?

提前感谢:)

推荐答案

m使用localstorage,这是保存数据的最佳解决方案。像你说的,它不是100%永久。在我的情况下,localstorage只有在您卸载应用程序时才会清除。使用Phonegap查找有关localstorage的更多信息
http:// docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#localStorage

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

您可以在
上获取有关localstorage的详细信息 http://diveintohtml5.info/storage.html

您也可以使用数据库。您可以在
上找到相关信息 http:// docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#open数据库

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

这篇关于Phonegap如何在Android上保存永久数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆