sendFile
Sends a file attachment in this conversation, with an optional text message.
The file must be a File on the local filesystem. When using the Android file picker, copy the content URI to a temporary file before calling this method:
Return
Result.Success with the sent ConversationEntry, or Result.Error on failure.
Parameters
file
The File to upload and send.
message
Optional text to include alongside the attachment.
Samples
val tempFile = java.io.File(context.cacheDir, "attachment_${System.currentTimeMillis()}")
context.contentResolver.openInputStream(uri)?.use { input ->
tempFile.outputStream().use { output -> input.copyTo(output) }
}
conversationClient.sendFile(tempFile, message = "See attached")Content copied to clipboard