/ SDKs / Android
SDKs
Chat SDKs Android v4
Chat SDKs Android
Chat SDKs
Android
Version 4

Update a poll

Copy link

You can update a poll by creating and passing a PollUpdateParams object as an argument to the parameter in the updatePoll() method.

KotlinKTX
val params = PollUpdateParams(
        title = "Updated Title",
        data = PollData("Updated Poll Data"),
        allowUserSuggestion = false,
        allowMultipleVotes = false,
        closeAt = System.currentTimeMillis()
)
channel.updatePoll(pollId, params) { poll, e ->
    if (e != null) {
        // Handle error.
    }

    // The poll is successfully updated. 
}

PollUpdateParams

Copy link
Parameter nameTypeDescription

title

string

Specifies the title of a poll.

data

PollData

Specifies an additional data to accompany the poll. A use case might be to provide explanations for incorrect quiz answers.

allowUserSuggestion

Boolean

Determines whether to allow users to make suggestions. (Default: false)

allowMultipleVotes

Boolean

Determines whether to allow users to vote on more than one poll options. (Default: false)

closeAt

Long

Specifies the time when a poll has closed or will close in Unix seconds. If the value of this property is -1, the poll status remains open meaning that the poll will never close.

PollHandler

Copy link

Through PollHandler, the Sendbird server always notifies whether your poll has been successfully updated.

fun interface PollHandler {
    fun onResult(poll: Poll?, e: SendbirdException?)
}