android – How to sync data between different devices-ThrowExceptions

Exception or error:

I am planing to implement an app and I have come to a point where I don’t know what is the best approach.

Scenario:

I have an app where I am making a todo list and I am adding 3 items. I use my phone for this.
Then I take my tablet and want to continue adding another task. Then after a while I take my wife’s phone and want to add 2 new tasks.

Basically I want to have a very simple way of storing the tasks online and be able to sync it with the app.

I am seeing two possible ways:

  • have a web server with a database + web service calls. This has the disadvantage of having a host paid, learn some extra mysql + web service techniques.

  • store somehow the data on cloud and allow the app by login to access an account which stores the file. I am thinking here at something like Google Drive / Dropbox. But I don’t know how I would be able to sync only the updated values, not the whole file. Because I am thinking, if I store all the tasks into one file, each time I update the file, I’ll need to upload it fully, which is not the best approach.

I am open to any advices. What approach would you recommend ?

How to solve:

I would look into either Google App Engine or Amazon Web Services. They both give you free allotment of usage per month and if you go over then you start paying, chances are you wont get past the free tier for a while.

AWS is a bit more mature than GAE currently and seemed to be a bit easier to implement that GAE was when I was researching them

###

There’s also Google Drive’s “Application Data” folder.

https://developers.google.com/drive/android/appfolder

This has the advantage of using the user’s storage space.

###

Take a look at the new training class for sync adapters:
http://developer.android.com/training/sync-adapters/index.html for the basics of sending data from your device to a server.

On the Android device, I suggest you store your tasks in a content provider. This helps you keep track of updates since the last time you synced. You can then query the provider during your sync, send only the data that’s been updated, and store the data on the server.

You should probably store the last update time on the device, so you can tell if the server contains data that isn’t yet on the device. Remember that you’ll have to download tasks as well if you want all devices to be in sync.

###

You can try Google’s Firebase. Firebase provides SDK for Android and iOS devices. And also, firebase supports offline and syncing. Firebase also provides object storage service. It easier to create firebase app than you think. Have look at this firebase’s firestore service.

###

You can take a look at our Rethync framework (freeware with source) . Using it you can simplify the task of detecting modifications and sync only updated data. Next, Rethync provides both client- and server-side API so you can create your own service (and host it on the web side) or you can write your own transport for the cloud service of your choice (we will provide some transports in future, they are under development now).

Leave a Reply

Your email address will not be published. Required fields are marked *