title: How to correctly use Google Plus Sign In with multiple activities?
body: <p><strong>What would be a good/recommended way of tying up the Google+ api client life cycle with the flow of a multi-activity app? Make the activities depend on the onConnected api client method to trigger its functionality, use it as a one-time only "activation" thing, or maybe something else entirely?</strong></p>
  
  <p>I am currently struggling to understand how to correctly use the Google+ sign in in my Android app, which has more than one activity.</p>
  
  <p>The idea is, in a first phase, to use the G+ sign in just to authenticate the user and be able to get her email, to send notifications and stuff like that. Eventually I plan to roll out other Google functionality like maybe Maps or other Google Play services, so I think it's useful to implement it already.</p>
  
  <p>However, my app is not behaving as expected, and I have narrowed down the issue to the fact that I have not yet understood the G+ sign in app cycle when more than one activity is present.</p>
  
  <p>What is the correct or recommended way to implement this auth method? is there maybe a pattern of sorts that could guide me in the right direction?</p>
  
  <p>For example, I have found <a href="https://web.archive.org/web/20181010193339/http://www.riskcompletefailure.com/2013/03/common-problems-with-google-sign-in-on.html" rel="nofollow noreferrer">a very simple diagram</a> of the life cycle of <em>the api client</em>, but how does this relate to the app flow? </p>
  
  <p>Initially I have a Login Activity, where I put the sign in button. Following <a href="https://developers.google.com/+/mobile/android/getting-started" rel="nofollow noreferrer">Google's guide</a> I am able to sign in, and when the onConnected method is called, I start the Home Activity (kinda like the dashboard or main screen of the app).</p>
  
  <p>This works somewhat. For example, what would be a good way of handling the onStart and onStop for each activity? should I re-connect and re-authenticate the api client every time for every activity? So maybe its a good idea to have a BaseActivity to implement all this.</p>
  
  <p>Another issue is, should I use the same api client object and pass it around somehow, or maybe store it in the Base Activity class? or should I be creating and initializing a new api client object every time?</p>
  
  <p>How about just using the Login Activity to authenticate with G+ and then just get the email and store it in a local database, and flag the user as "authenticated" or "active" or something. That would prevent me from having to re-authenticate every time the app is closed or connection is suspended, even allowing for some battery savings. </p>
  
  <p>The app is not really using G+ posting or any other functionality like that. Ideally it should work well offline, and only need connection for stuff like initial authentication or other one-time only things.</p>
  
  <p>Any suggestions or pointers in the right direction are very much appreciated.</p>
  
  <p>Edit: I have read every guide and tutorial I could find, that uses Google+, and every one of them addresses this from a single activity perspective. I would think this is a common enough problem that it would benefit from a pattern or at least a general guideline.</p>