4
Plus.PeopleApi.load(mGoogleApiClient, googleUser.getId()).setResultCallback(new ResultCallback<People.LoadPeopleResult>() {
            @Override
            public void onResult(@NonNull People.LoadPeopleResult loadPeopleResult) {
                Person person = loadPeopleResult.getPersonBuffer().get(0);
                gender = person.getGender();
                loadPeopleResult.release();
            }
        });

This is the code I used until now to get gender from GoogleSignInAccount, which is currently the proper way of implementing Google sign in into Android apps. But since the 9.4.0 update for the com.google.android.gms:play-services-plus, the whole Plus class is deprecated, including the PeopleApi and load method. I've read tons of Google documentation, but I just can't find a proper way to get gender.

Marko Gajić
  • 431
  • 4
  • 15
  • 1
    Unfortunately gender is not available yet in the new Google Sign-In API, but it's a known deficiency and we're working on adding it. I'll update this once we are able to make it available. In the meantime, even with the older API, gender may not be available for some users, so you'll have to fall back to collecting it your own UI after signing a user up, so hopeful that can be an interim solution. – Steven Aug 03 '16 at 17:41
  • @StevenSoneff Thank you for making this clear. I'm looking forward to gender being added to the Sign-In API. Cheers! – Marko Gajić Aug 04 '16 at 11:57

1 Answers1

1

Yes Plus is deprecated.

Have you tried the package: com.google.android.gms.plus.model.people I think this could be the documentation you're looking for: https://developers.google.com/android/reference/com/google/android/gms/plus/model/people/package-summary

There you can see they changed the API to plus.model.people and a subclass is Person.Gender . Then the method that is specified for gender is:
getGender() .

Royce
  • 189
  • 6
  • 18
  • 1
    Yeah but how to get Person object? There are no good code samples, and the documentation itself is not clear to me. Anyways, take a look at the comment on my original question, one of the Google guys explained that gender is not officially available at the moment as part of the Sign-In API, but it should be available sooner or later. – Marko Gajić Aug 04 '16 at 12:00