Skip to main content

Introduction

The meetings polls object can be accessed using meeting.polls. It provides methods to create polls, vote, and more.

meeting.polls.polls returns an array of all polls created in a meeting, where each element is an object of type DytePollMessage.

data class DytePollMessage(
val id: String,
val question: String,
val anonymous: Boolean,
val hideVotes: Boolean,
val createdBy: String,
val options: List<DytePollOption>,
)

The type DytePollMessage represents a poll in a Dyte meeting. It also contains list of DytePollOption which are options for a given poll. And every DytePollOption has list of votes inside of it. Votes are objects of class DytePollVote which internally has id and name of the vote.

data class DytePollOption(
val text: String,
val votes: List<DytePollVote>,
val count: Int
)

data class DytePollVote(
val id: String,
val name: String
)

One can easily create, vote and view polls by listening to callbacks on meeting object.

Listening to new polls in a meeting

To be able to receive new poll messages you need to implement a method onPollUpdates() method from callback DyteMeetingRoomEventsListener. You can subscribe to this events by calling meeting.addMeetingEventsListener(dyteMeetingRoomEventsListener)

meeting.addMeetingRoomEventsListener(object :
DyteMeetingRoomEventsListener {
override fun onNewPoll(poll: DytePollMessage) {
// code to handle new poll
}

override fun onPollUpdates(pollMessages: List<DytePollMessage>) {
// code to handle polls and their vote updates.
}
})