views:

242

answers:

2

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.

+3  A: 

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/

Aaron Saunders
But can you store it on the remote database server?
never_had_a_name
yes you can, i have implemented an app that saves data on the server in the backend through a REST API on the server
Aaron Saunders
+1  A: 

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.

k00k