Search code examples
androidgoogle-plusreal-timemultiplayer

Google Real Time Multiplayer players names


everything works fine when creating a room and automatch too, but the problem is when i call p.getDisplayName(), in this code it dosn't return the opponent name it returns some junk letters ..

      void updatePeerScoresDisplay() {
    ((TextView) findViewById(R.id.score0)).setText(formatScore(mScore) + " - Me");
    int[] arr = {
            R.id.score1, R.id.score2, R.id.score3
    };
    int i = 0;

    if (mRoomId != null) {
        for (Participant p : mParticipants) {
            String pid = p.getParticipantId();
            if (pid.equals(mMyId))
                continue;
            if (p.getStatus() != Participant.STATUS_JOINED)
                continue;


           int score = mParticipantScore.containsKey(pid) ? mParticipantScore.get(pid) : 0;
            ((TextView) findViewById(arr[i])).setText(formatScore(score) + " - "+
                    p.getDisplayName());
            ++i;
        }
    }

Solution

  • It returns something like Player234, it won't return the player's name, even if he/she is in your circles (as I have experienced). That's the point of a random opponent match.

    google play game realtime multiplayer how to get quickmatch player's name?