How to develop an offline-first native Android app
Asked Answered
T

3

10

We are developing a native Android app (iOS and web to follow) where users can collaboratively create an album.

We want as seamless as possible experience when device is not able to connect with server. Something like mentioned in this Hoodie blog but Hoodie is right now for Web and iOS and we are looking for Android right now.

Problem

Maintaining data of albums, friends, pictures (URL/local, not Bitmap) on Client side. Being able to sync offline create/update operations to server at later time, with conflict resolution.

Current research

  1. HTTPResponseCache: Cons: Caches only requests which have been hit once. Plus need different system to handle create/update actions.
  2. App42, Kinvey: Backend-as-a-service; Cons: We want to have own backend.
  3. Microsoft Sync Framework Toolkit: Not sure how well it works with Android
  4. PouchDB
  5. Superbus: Solves a part of the problem

Custom

Maintain data in SQLite on Android and MySQL on server Sync using Android Sync Adapter. However, this can be time consuming and have bugs in starting.

How should this problem be approached?

Thinskinned answered 17/9, 2014 at 9:40 Comment(0)
A
11

I am working on a project at the moment, and we need to track deliveries and verify deliveries even when user is offline. The approach I use is to make use of this ContentProvider plugin Simple Content Provider. And I check if there's internet or not, and if there's none. It stores the data to the provider and change whatever needs to be changed in the DATABASE and make my user believe he or she has completed the order. And I've a SyncAdapter waiting for the internet to come on. And, I've a push service too to refresh the database once there's a change in the database. Having an understanding of Google Cloud Messaging would save your user a lot of battery life. There might be better options out there. But, from my little experience with Android that's how my little help could be.

Antonelli answered 18/9, 2014 at 19:53 Comment(1)
After searching through, I think this is indeed the way to do it. Thanks.Thinskinned
P
2

Did you had a look in CouchBase Server and CouchBase Lite?

They provide a powerfull tool called the SyncGateway wich handle for you all the syncronisation and the merging of the datas between the server and the internal database. You don't have to code anything in your mobile App for the synchonisation.

Couchbase Lite is availbe for iOS and Android. There is also a plugin for Cordova/PhoneGap available.

I never had any problem to compile it, just for iOS keep in mind to compile for iOS6+, it does not work with iOS5

Precontract answered 1/10, 2014 at 4:50 Comment(1)
No, didn't have a look at this earlier. Looks promising though. Right now, it is late to go with this architecture as development is half way through.Thinskinned
M
-1

You can check out an open source api for this called Wendy the most amazing thing about it is that it uses your existing architecture.

Metaphysic answered 14/12, 2018 at 2:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.