Android Best Pratices : Best way to check for Google account existence?
<p>I've recently started developing for the Android platform and am currently praticing with an application that sync with Google Tasks. Right now, I'm not facing too much problem, technically speaking. But I meet a conceptual problem that I can't find a proper way to solve.</p>

<p>Let's say the user uses my application with a given Google account. He launch some activities, do some work...and then click the Home button. He then goes to the OS Settings and delete its Google accounts. Then he returns to my app, which then display the activity he was using when he did quit the app.</p>

<p>Since there is no more Google Accounts, my application should present the "Add Account" activity to allow him to choose or create a Google Account. And of course, if he tap on the back button at this point, he should be sent to the launcher and not to the previous activity from the back stack.</p>

<p>How would you deal with that kind of need ?</p>

<p>I first thought that it was possible to be notified when my app was back to the foreground but it seems that Android always deals with activities, which would mean that I have to implement an "account checker" on all my activities ! Moreover, even if I implement this, how would I prevent the user from returning to the back stack and be instead redirected to the launcher when he taps the back button ?</p>

<p>If some of you can give me some advices, some Best Pratices, to deal with this, you would make my day.</p>

<p>Thanks for your help,</p>

<p>Eric.</p>

<p>PS : I just checked the Android 4 included GMail app and when I delete all my Google Accounts and then launch the app, I'm presented with the system "Add Google Account" activity and taping the back button send me to the launcher. That's exactly the behavior I'd like to implement. I suppose this app is not open-source, right ?</p>
