I am using Firebase Google SignIn in my Android application and I want to check the gender of every user, as the application is only for the females to use !!
Currently work is like this
// Initialize Firebase Auth
mFirebaseAuth = FirebaseAuth.getInstance();
mFirebaseUser = mFirebaseAuth.getCurrentUser();
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(FirebaseAuth firebaseAuth) {
if (mFirebaseUser == null) {
startActivity(new Intent(getApplicationContext(), SignActivity.class));
finish();
return;
} else {
if (mFirebaseUser.getPhotoUrl() != null) {
Glide.with(HomeActivity.this)
.load(mFirebaseUser.getPhotoUrl().toString())
.asBitmap()
.into(new SimpleTarget<Bitmap>(100,100) {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) {
bitmap = resource;
}
});
}
}
}
};
// Configure Google Sign In
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this ,this)
.addApi(Auth.GOOGLE_SIGN_IN_API , gso)
.build();