If needed, you can track the progress of file upload by passing FileMessageWithProgressHandler as an argument to a parameter when calling the sendFileMessage() method.
kotlinktx
val params = FileMessageCreateParams(FILE).apply {
fileName = FILE_NAME
data = DATA
customType = CUSTOM_TYPE
}
val fileMessage = channel.sendFileMessage(
params,
object : FileMessageWithProgressHandler {
override fun onProgress(bytesSent: Int, totalBytesSent: Int, totalBytesToSend: Int) {
val percent = (totalBytesSent * 100) / totalBytesToSend
}
override fun onResult(message: FileMessage?, e: SendbirdException?) {
if (e != null) {
// Handle error.
}
// You can handle actions relevant to the sent file message.
// ...
}
}
)