Chat / Android
Chat Android v4
Chat Android
Chat
Android
Home
/
Chat
/
Android
/
Message
This is the new Docs for Chat SDK v4 for Android. To see the previous Docs, click here.

Update a scheduled message

You can update a scheduled user message by passing ScheduledUserMessageUpdateParams as an argument to the updateScheduledUserMessage() method.

// Updates a scheduled user message.
val params = ScheduledUserMessageUpdateParams().apply {
    scheduledAt = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5)
    message = "Text message"
    translationTargetLanguages = listOf("en", "ko")
    data = null
    customType = null
    mentionType = MentionType.USERS
    mentionedUserIds = listOf(MENTIONED_USER_ID)
    metaArrays = null
    appleCriticalAlertOptions = null
    pushNotificationDeliveryOption = null
}

groupChannel.updateScheduledUserMessage(scheduledMessageId, params) { scheduledUserMessage, e ->
    if (e != null) {
        // Handle error.
    }

    // A scheduled user message has been successfully updated.
}

You can also update a scheduled file message to send at a later time by passing ScheduledFileMessageUpdateParams as an argument to the updateScheduledFileMessage() method.

// Updates a scheduled file message.
val params = ScheduledFileMessageUpdateParams().apply {
    scheduledAt = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5)
    // Set `fileUrl` or `file` exclusively.
    fileUrl = FILE_URL
    file = FILE

    fileName = "Name of the file"
    mimeType = MIME_TYPE
    fileSize = FILE_SIZE
    thumbnailSizes = listOf(ThumbnailSize(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT))
    data = null
    customType = null
    mentionType = MentionType.USERS
    mentionedUserIds = listOf(MENTIONED_USER_ID)
    metaArrays = null
    appleCriticalAlertOptions = null
    pushNotificationDeliveryOption = null
}

groupChannel.updateScheduledFileMessage(scheduledMessageId, params) { scheduledFileMessage, e ->
    if (e != null) {
        // Handle error.
    }

    // A scheduled file message has been successfully updated.
}