Hello all actually i need to sign in people from google+ through my app now i read documentation on google where it isstated that
To allow users to sign in, integrate Google Sign-In into your app. When you initialize the GoogleApiClient object, request the PLUS_LOGIN and PLUS_ME scopes
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(Scopes.PLUS_LOGIN)
.addScope(Scopes.PLUS_ME)
.build();
Now i am confused that whether should i use above code only or implement google sign-in first and after that in my onsuccess method write this code to fetch person's profile from google+. Also in above code Scopes.Scopes.PLUS_LOGIN was not working so i have used PLUS.PLUS_LOGIN google's docs is so old.
Now i have used above code but it is not signing in from google+ account only it shows a dialog that from which account i need to sign in but when i click on that account it doesn't do anything also currently i am using google-sign integration see below code
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
and everthing is working great but i need person's gender and his/her date of birth that's why i thought about using google+ but the problem is google+ integration is not working for me what should i do now ??
If anyone know how to fetch person's gender or date of birth using any of the two google+ OR google sign-in api please tell me how can i do this it could really mean something for me.
Because you have said your current app works well with Google Sign-in already, so in order to get Google+ profile information such as Gender, Birthday..., first of all, make sure you have created Google+ profile for your Google account. Then you can update your app with the following codes. Please pay attention that I use
.requestScopes(new Scope(Scopes.PLUS_LOGIN))
atGoogleSignInOptions
, not atmGoogleApiClient
.and
Then
Inside
build.gradle
fileP/S: if Google+ profile has been created but after the time you add Google account in your device, you need to delete that existing Google account from your device, then re-add. When you run your app again, the message asking you allow/deny to access Google+ will be displayed. And of course, you must click Allow.
Hope this helps and is clear for you!
I think this question is what you are lookin for.it clearly explains how to get user info. hope this answers your question.