Reputation: 1129
I'm developing a custom Contacts app that will store data on the device in a SQLite database. It's very important that this device database may be synchronized with a cloud database, for some reasons:
Users may have more than one device and wish to have their app data up-to-date on all devices; Users may be able to access these data from a web application; As this app will store many pictures, device memory will not be enough to hold all data and an archive option will be available to keep data only on the cloud database. Archive to the cloud will be done automatically for older records. A restore option will be available to download data for records when needed. As you can see, device database will hold contacts for one user and the cloud database will be a similar db but holding data for all users. So, there is a logic in this synchronization. It`s not just a matter o copying the entire SQLite DB file up and down. This must be a row/column level synchronization.
I'm wondering which kind of solution can i use to accomplish this? Is it possible to use Google Cloud or App Engine to implement the server-side? What can I do on the device side? Any ideas?
I really appreciate any answers.
Thanks.
Upvotes: 8
Views: 6167
Reputation: 2440
I can strongly recommend that you look into using Google Cloud Messaging, and more specifically. The "Send to Sync" pattern.
As to the specifics of the detecting record changes and syncing, I cannot offer good advice except to say that this feature is done by many database system so you might want to look into how they solve it. Most common ones include timestamps and version numbers.
Reference links: Google I/O session on GCM (I find this a nice intro to get you started on GCM) http://www.youtube.com/watch?v=YoaP6hcDctM&list=PL4C6BCDE45E05F49E&index=9
Google Cloud Messaging documentation (link direct to send to sync) http://developer.android.com/google/gcm/adv.html#s2s
Upvotes: 2
Reputation: 6962
You can use any 'cloud' based webservice you want, you have the full strength of Java and solid http libraries available to you on the phone. It is certainly possible to build an app/webservice on a platform like Amazon EC2 or App Engine and then call that directly from your app, handling the security, storage, and synchronization on your own.
Personally, in my experience, I use Django/Python on EC2 (along with a variety of AWS data services) and it works great.
Separately, I know that there are a variety of startups building out-of-the-box solutions for your scenario - i.e. special SDKs and backend services targeted just for mobile developers. I do not have any experience with these, but here are two of which I'm aware (no endorsement, just links): https://www.parse.com/ https://www.stackmob.com/
Upvotes: 3