0

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?

Zoe
  • 27,060
  • 21
  • 118
  • 148
BubbaKush
  • 60
  • 7
  • What other types of registration you have? Do you use FirebaseUI registration form? – Bo Z May 02 '19 at 14:50
  • My objective is to use only Google registration. Get theID online and show them to everyone. Make a playerlist in other words. – BubbaKush May 02 '19 at 15:16

1 Answers1

1

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

Bo Z
  • 2,359
  • 1
  • 13
  • 31
  • I thought something like that to solve the problem, but I do not know much code from Firebase to call an object (User) and show It, I will search info and post it here if I found the solution. Thanks for the advice. – BubbaKush May 02 '19 at 15:14
  • 1
    Did my answer was useful? If so could you mark it as an answer? – Bo Z Jul 02 '19 at 13:10