Display Attendees Count - Android
In this guide, we will see how you can display the number of attendees in realtime.
note
Before going forward in this guide, do make sure all the attendees join the meeting with mode as VIEWER
- We will get the all the
participants
except local participant usinggetParticipants()
method of the theMeeting
class. With all the participants, we will filter out participants who have joined as aVIEWER
and then display that count.
- Kotlin
- Java
private fun showViewerCount() {
var viewerCount = 1 // start with 1 to count local participant
val participants = meeting!!.participants
for (entry: Map.Entry<String, Participant> in participants.entries) {
val participant = entry.value
if (participant.mode == "VIEWER") {
viewerCount++
}
}
this.viewerCount!!.text = viewerCount.toString()
}
private void showViewerCount() {
int viewerCount = 1; // start with 1 to count local participant
Map<String, Participant> participants = meeting.getParticipants();
for (Map.Entry<String, Participant> entry : participants.entrySet()) {
Participant participant = entry.getValue();
if (participant.getMode().equals("VIEWER")) {
viewerCount++;
}
}
this.viewerCount.setText(String.valueOf(viewerCount));
}
API Reference
The API references for all the methods utilized in this guide are provided below.
Got a Question? Ask us on discord