Search code examples
androidrestarchitectureandroid-syncadaptergoogle-signin

Architectures for RESTful Android Applications


I'm currently developing an Android application and I'd like to have an scalable architecture with a clean separation of concerns. The requirements of this application are, mainly:

  • User autentication (I'm dealing now with Google Sign-In for Android after many unsuccessful fights agains Android Identity Toolkit)
  • Synchronization with REST services (this application should be collaborative, I've already done a proof of concept to consume a "heartbeat" service, using AsyncService, that was the only way I've found to clean activies code, I got to that library researching about Robust Android Architectures)
  • ORM at client side to store user generated data and retrieved data in the future (my choice has been ORMLite for Android)
  • Material Design (as the best approach to the UI I have in mind)

First of all I'd like advices on how to separate classes inside the project, I mean, should I use folders (activity, model, DAL, service, sync...) or should I create my own libraries? (in .Net I'd create libraries with parent namespace)

My second and biggest concern is about user identity: how should looks like my architecture to achieve my goals? (sign up / Sign in with multiple providers, authenticated rest client and synchronization using SyncAdapter)

I hope you don bane this quiestion because maybe is too generic but I ask about all this stuff because I couldn't find information or advices about this stuff.

Thank you in advance.


Solution

  • This is a generic question and every dev has his own way to achieve this, but I would recommend to follow one of the trending patterns right now.

    There is a project call the clean architecture. It has pretty much everything from dB to Api. In my opinion is a over-engineered.

    I prefer another pattern called Flux.

    Together with retrofit, eventbus or Otto makes building apps easy and keep the structure

    You can read more about it here:

    http://lgvalle.xyz/2015/08/04/flux-architecture/