开发者

Best way to locally store a data base with Phonegap

开发者 https://www.devze.com 2023-04-01 00:48 出处:网络
I am developing a quiz app for Android and iOS (and hopefully BB) with Phonegap. When storing the Q&A I am considering using a database, SQLite as recommended, but I would like to store the data o

I am developing a quiz app for Android and iOS (and hopefully BB) with Phonegap. When storing the Q&A I am considering using a database, SQLite as recommended, but I would like to store the data offline so once you have downloaded and instal开发者_如何学JAVAled the app, it doesn't need to pull the data from the cloud. I know there are some solutions in this regards for SQLite, but I'd like to know which solution is best: XML file, JSON file, SQLite database, any other? I'd like to take in to consideration processing speed, file size and scalability.

Thank you


I've not worked with it, but have seen Lawnchair mentioned a few times in the PhoneGap Google Group.


Personally, I use WebSQL (SQLite) with success in more than 13 apps (iOS + Android). It's fast and powerful.

By the way, in iOS5.1, WebSQL is now considered temporary data that can be deleted at any time...

But it's possible to use a native SQLite DB with a phonegap plugin. That plugin save the database in the Document folder, that mean that the DB is not deleted and is saved by iCloud.

Here is the Native SQLite phonegap plugin : https://github.com/davibe/Phonegap-SQLitePlugin Regarding this plugin, there are some differences between the WebSQL API, here is an adaptor: https://gist.github.com/2009518

And if the data are important, you should save it to a server. I wrote a small lib to synchronize the SQlite DB to a server : https://github.com/orbitaloop/WebSqlSync

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号