
Show HN: Add GCM to your Android app in 5 minutes - habosa
https://github.com/googlesamples/easygoogle
======
habosa
EasyGoogle is an experiment of mine to make the common use cases for Google
APIs dead simple on Android. You can add any of the features below in just a
minute or two:

    
    
      * Google Sign In
      * Google App Invites (email/sms user-to-user invites)
      * Google Cloud Messaging (my favorite since it's hard to get right)
      * SmartLock for Passwords (cross-device password sync, used by Netflix, NYTimes, and others)
    

Would love feedback, and PRs are welcome!

~~~
on_and_off
I am taking over a legacy implementation of Google Sign-In and trying to
switch it to the new 8.3 one (because asking for 'get contacts' just suck
terribly). I don't really need a lib such as easy google though, I would have
preferred more documentation on how it is recommended to handle some basic use
cases.

For example : login in a first loginActivity then logout in another. Am I
supposed to keep the GoogleApiClient somewhere at Application scope or to
recreate it in each screen where I want to interact with it ?

~~~
habosa
Totally agree, you shouldn't (and don't) have to use a lib like easygoogle to
get Google Sign In implemented correctly on Android!

In the multi-activity situation you will want to re-instantiate your
GoogleApiClient in each Activity. If you use the function enableAutoManage
that keeps it pretty lightweight, you don't need to implement
ConnectionCallbacks (since the new API does not have the notion of connection
== signed in) and you can have a one-line implementation of
OnConnectionFailedListener.

If you have a question about any of this, raise an issue on this repo
([https://github.com/googlesamples/google-
services](https://github.com/googlesamples/google-services)) and I'll answer
it.

