How to sync data between different devices
Asked Answered
M

5

25

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 ?

Mantel answered 16/7, 2013 at 20:31 Comment(3)
Google Cloud Save sounds like the perfect solution, but it has not been released yet...developer.android.com/google/gcs/index.htmlApplause
Hi @Alin, I also have a similar requirement, what did you end up using?Georgena
Hi, well, that sure was a long time ago. In the end I did not made the project as expected. I suppose that if I were to make it now, I'd take a good look at Firebase Firestore as in an answer below.Mantel
S
9

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

Stopoff answered 16/7, 2013 at 20:36 Comment(1)
Thank you for your options. Also DropBox Datastore api seems a really nice free alternative...Mantel
D
16

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.

Dukie answered 2/12, 2014 at 21:20 Comment(3)
I think you have to have the same account on both devices for this, which is likely not true for "taking my wife's phone".Psyche
@Psyche Wouldn't it just mean the same account needed to be used to login to the device?Alderney
@Alderney You're correct. I think TWiStErRob 's point is that OP is unlikely to have their account on their wife's phone. So while it may be an easy way to sync data across devices, it doesn't necessarily meet all the requirements of the question.Dukie
S
9

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

Stopoff answered 16/7, 2013 at 20:36 Comment(1)
Thank you for your options. Also DropBox Datastore api seems a really nice free alternative...Mantel
M
3

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.

Mowry answered 16/7, 2013 at 22:25 Comment(0)
S
1

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.

Scheld answered 8/4, 2018 at 17:32 Comment(0)
C
0

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).

Cataphyll answered 17/7, 2013 at 10:35 Comment(2)
Looks like this never made it past the pre-release. Is this still actively being developed? Any updates? A roadmap?Keith
@Keith It's stable and fully functional, and includes documentation. Should there be an issue reported, we will update the implementation accordingly. As for future developments - the engine in its current state is self-contained, i.e. any new features would not fit the current concept of the synchronization engine. The things like TLS, on the other hand, are already there (by using the transports that support TLS).Maloney

© 2022 - 2024 — McMap. All rights reserved.