title: How to handle Multiple Social Media Logins and sessions Flow on Android?
body: <p>I have created an android app that has a Navigation Drawer with Fragments.</p>
  
  <p>I then started with Social Media Integrations, that is Facebook, Twitter and Google Plus. I am using the official respective SDK's.</p>
  
  <p>Not Social Media Sessions and calls to acquire data are made in the following activities: </p>
  
  <ul>
  <li><p><code>Mainactivity</code> : Where if any of the sessions are lost or revoked, it needs to redirect to <code>LoginActivity</code>. This is done during activity lifecycle methods. </p></li>
  <li><p><code>LoginActivity</code> : Where the permission are granted and redirects to Main after success</p></li>
  <li><p><code>NavigationDrawerFragment</code> : The Navigation drawer, I use this to display the user's profile image, name and email address.</p></li>
  </ul>
  
  <p>In these 3 classes I am making calls to the respective SDK methods and managing the sessions so there is a lot of code duplication.</p>
  
  <p>Also the 3 SDK's have significantly different ways of providing authentication.</p>
  
  <ul>
  <li>Facebook: uses the <a href="https://developers.facebook.com/docs/reference/android/3.5/class/UiLifecycleHelper/"><code>UiLifeCycleHelper</code></a> that is implemented on all your standard lifecycle functions of an activity.</li>
  <li>Google Plus: You have to implement <code>GooglePlay</code> store callbacks in the activity and create a <code>GoogleApiClient</code> on all activities.</li>
  <li>Twitter: Has less of a "taking over your app" attitude and uses retrofit in the same manner of a usual REST API call on android: with <a href="http://square.github.io/retrofit/">Retrofit</a>. However you have to give permissions on every login.</li>
  </ul>
  
  <p>So All of these functions for handling the different social media logins are included in all the required activities making the application code really bulky and hard to manage.</p>
  
  <p>Do you have any suggestions on how to abstract these auth methods into a easily maintainable solutions that makes manging sessions easier?
  Would I be better off to have separate activities based on what login was used?</p>