Android Google+ integration – repeated UserRecoverableAuthException

I’ve had this issue for a while and came up with a proper solution. String token = GoogleAuthUtil.getToken(this, accountName, scopeString, appActivities); This line will either return the one time token or will trigger the UserRecoverableAuthException. On the Google Plus Sign In guide, it says to open the proper recovery activity. startActivityForResult(e.getIntent(), RECOVERABLE_REQUEST_CODE); When the activity … Read more

Retrieving a user’s public google/gmail picture

Is very easy http://picasaweb.google.com/data/entry/api/user/<hereYourUserIdOrYourEmail>?alt=json just has a little problem. You only can get the picture of your Google+ profile, not directly from your gmail. UPDATE: This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application. More … Read more

How to correctly use Google Plus Sign In with multiple activities?

Reconnecting for each activity is absolutely fine. Broadly there are 3 ways I’ve seen of people implementing this: Implement mostly in a baseactivity, and have the others extend that. This is connect/disconnect in each activity, but with code in only one place. Implement connect/disconnect in a fragment, and include that in activities where auth is … Read more

Google API: getting Credentials from refresh token with oauth2client.client

I use: oauth2client.client.GoogleCredentials cred = oauth2client.client.GoogleCredentials(access_token,client_id,client_secret, refresh_token,expires_at,”https://accounts.google.com/o/oauth2/token”,some_user_agent) http = cred.authorize(httplib2.Http()) cred.refresh(http) self.gmail_service = discovery.build(‘gmail’, ‘v1’, credentials=cred)