开发者

PhoneGap and Appcelerator store data locally and remotely?

开发者 https://www.devze.com 2023-01-12 10:54 出处:网络
I wonder if I could store data with PhoneGap and Appcellerator both locally and remotely (postgresql in my web application)?

I wonder if I could store data with PhoneGap and Appcellerator both locally and remotely (postgresql in my web application)?

Cause it's gonna be a 开发者_如何学编程realtime app that has to sync data between the mobile and remote backend server.


yes you can, with PhoneGap, I am not familiar with Appcellerator.

With PhoneGap you can store to local database

http://phonegap.pbworks.com/Adding-SQL-Database-support-to-your-iPhone-App

Or you can store to the file system

http://phonegap.pbworks.com/JavaScript-API#file

Complete Documentation http://docs.phonegap.com/


In order to do remote data storage, you don't typically rely on the PhoneGap or Appcellerator inherent data storage mechanisms, but more on your remote server's abilities. You can take advantage of the local data storage for offline use.

I would set up my mobile app so that it does the following:

  • Checks to see if it's networked/online
  • If offline, reads/writes data to a local db on the device
  • If online, reads/writes data to a remote server via an HTTP call and provides/retrieves a JSON object from the HTTP server's API/DB

This introduces other issues around syncing that you'll need to begin to think about.

That's the basics anyway, and I think it answers your question. Let me know if you need more detail.

0

精彩评论

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

关注公众号