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.

Cancel an in-progress file upload

Using the cancelFileMessageUpload() method, you can cancel an in-progress file upload while it hasn't been completed yet. If the function operates successfully, the value of true is returned.

Note: If you attempt to cancel the upload after it has already been completed or canceled, or the attempt results in an error, the function returns the value of false.

val params = FileMessageCreateParams(FILE).apply {
    fileName = FILE_NAME
    data = DATA
    customType = CUSTOM_TYPE
}

val fileMessage = channel.sendFileMessage(params) { message, e ->
    // ...
}

// Cancel uploading a file in the file message.
val isCanceled = channel.cancelFileMessageUpload(fileMessage.requestId)