0

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.

Juan
  • 2,156
  • 18
  • 26
  • I believe Google Identity Toolkit for Android well solves your requirements of authenticating user and provide the identity to your REST service in a secure way. Have you posted your questions of Google Identity Toolkit on SO? – Jin Liu Aug 25 '15 at 22:35
  • Not yet, Jim Liu, I did a research on that topic a few days ago in addition to some tests i did with GIT in my project, but right now I'm in a middle of a huge architectural refactor so this topic has to wait until I finish with my current work in progress, but for sure if I still have that issues I'll ask concretely about that here in SO. Thank you! – Juan Aug 26 '15 at 07:07

1 Answers1

1

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/

straya
  • 5,002
  • 1
  • 28
  • 35
Marcel
  • 2,094
  • 3
  • 23
  • 37
  • The pattern that adapts better to my current architechture is "Clean Architecture". I've just found some good articles, Android related, about it here [link](https://github.com/android10/Android-CleanArchitecture) and better here: [link](http://fernandocejas.com/2015/07/18/architecting-android-the-evolution/) If in few days no one give me an advice (maybe you can) on how to "mix" Google Signin with sync adapter I'll mark your answer as the accepted. Thank you! – Juan Aug 24 '15 at 07:40
  • I don't really understand why you need to mix this. On thing is to use the Google Signin to let the user sign with your app and then the sync adapter is just to do background process in an optimised way that the OS decide. – Marcel Aug 25 '15 at 08:37
  • The point is that I'd like mi app to be sincronized with user related data which is going to be in the server and for doing so the server calls, through restful api calls, should be identified and authenticated, what I was wondering if already exists a mechanism that do this for me or helps with that instead of handle user credentials "by hand" in the app to use them on every call. As you can see I still have a mess in my mind regarding authentication from an end-to-end pov. Yesterday I started to migrate my code to a Clean Architure approach and I'll do my homworks with autentication asap. – Juan Aug 25 '15 at 10:00