Chat / Android
Chat Android v4
Chat Android
Chat
Android
Version 4
Home
/
Chat
/
Android
/
Message

Cast or cancel a vote

You can cast or cancel a vote by passing PollVoteEvent as an argument to a parameter when calling the votePoll() method. Use the optionIds property of the votePoll() method to update the user's final vote choice for a poll. This overrides previous vote actions, so to update previous votes, pass new pollOptionIds as a parameter. To cancel votes, pass an empty list as pollOptionIds.

channel.votePoll(pollId, optionIds) { pollVoteEvent, e ->
    if (e != null) {
        // Handle error.
    }

    // To apply the vote result to the poll, You need to take the following actions.
    // 1. Find a poll by pollVoteEvent.messageId and pollVoteEvent.pollId.
    // 2. Call userMessage.poll.applyPollVoteEvent(event: PollVoteEvent).
}