I want to make an Online App in Android, and when you log in you can see a ListView of all the Users logged in the App. My problem is that I do not know how to show, for example, all the emails of the people who logged in with Google Account. I know how to do It with the people who register and log in with the app. But I want to do It with the Google Accounts.
Right now, when You login, It shows you your profile data like name, email, ID... etc. with this code:
private void handleSignInResult(GoogleSignInResult result) {
if (result.isSuccess()) {
GoogleSignInAccount account = result.getSignInAccount();
nameTextView.setText(account.getDisplayName());
emailTextView.setText(account.getEmail());
idTextView.setText(account.getId());
Glide.with(this).load(account.getPhotoUrl()).into(photoImageView);
}
else {
goLogInScreen();
}
but now, I want that when you login, appears in a ListView all the users online. Could you help me?
The solution for that is not to call user information for views directly from GoogleSignForResult. Instead of that the better practice for that will be making separate table in Firestore / Realtime called as Users (for example) and after User register save his info in that table and put a flag that he registered as Google user or email registration or other type of registration. And only after that when each user have flag of recognition you could inflate your list and show the type of registration.
So change the logic it will make that step more flexible for you