title: Firebase Auth: Android: Unable to display user email and photo
body: <p>I have added Firebase Auth in my android app and I am using Facebook and Google sign in. Signing in is working fine. Now I want to retrieve user profile info from user's either Facebook account or Google account (whichever, user chooses to sign in) and display the info in user profile activity. I am able to retrieve and display user name and user UID, however, user email and user photo are not displaying, though retrieved.</p>
  
  <p><strong>Here is how I am retrieving user info (LoginActivity.java):</strong></p>
  
  <pre><code>authStateListener = new FirebaseAuth.AuthStateListener() {
              @Override
              public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
  
                  FirebaseUser user = firebaseAuth.getCurrentUser();
  
                  if (user != null) {
                      //User is signed in
  
                      for (UserInfo userInfo : user.getProviderData()){
  
                          String user_name = userInfo.getDisplayName();
                          String user_email = userInfo.getEmail();
                          Uri user_img = userInfo.getPhotoUrl();
                          String user_id = userInfo.getUid();
  
                          SharedPreferences preferences = getSharedPreferences(UserInfoConstants.STRING_NAME,0);
                          SharedPreferences.Editor editor = preferences.edit();
                          editor.putString(UserInfoConstants.KEY_USER_NAME, user_name);
                          editor.putString(UserInfoConstants.KEY_USER_EMAIL, user_email);
                          editor.putString(UserInfoConstants.KEY_USER_ID, user_id);
                          editor.putString(UserInfoConstants.KEY_USER_IMG, user_img != null ? user_img.toString() : null);
                          editor.apply();
                      }
  
                  } else {
                      //User is signed out
                      return;
                  }
              }
          };
  </code></pre>
  
  <p><strong>Here is how am displaying user info (ProfileActivity.java):</strong></p>
  
  <pre><code>SharedPreferences preferences = getSharedPreferences(LoginActivity.UserInfoConstants.STRING_NAME,0);
  
          String user_img_uri = preferences.getString(LoginActivity.UserInfoConstants.KEY_USER_IMG,"");
  
          if (user_img_uri.isEmpty()){
  
              userImgView.setImageResource(R.drawable.com_facebook_profile_picture_blank_portrait);
          } else {
  
              userImgView.setImageBitmap(getImageBitmap(user_img_uri));
          }
          userName.setText(preferences.getString(LoginActivity.UserInfoConstants.KEY_USER_NAME,""));
          userEmail.setText(preferences.getString(LoginActivity.UserInfoConstants.KEY_USER_EMAIL,""));
          userId.setText("ID: " + preferences.getString(LoginActivity.UserInfoConstants.KEY_USER_ID,""));
  </code></pre>
  
  <p>I searched a lot about it but is unable to get any resolution for the same.</p>
  
  <p>Can anyone help????</p>