Chat Android SDK
7.0.1
|
Used to construct new message before sending. More...
Public Member Functions | |
Options | withBody (String body) |
Create message with given body text. More... | |
Options | withAttributes (Attributes attributes) |
Set new message attributes. More... | |
Options | withMedia (InputStream in, String mimeType) |
Create message with given media stream. More... | |
Options | withMediaFileName (String filename) |
Provide optional filename for media. More... | |
Options | withMediaProgressListener (ProgressListener listener) |
Set upload progress listener for media. More... | |
Used to construct new message before sending.
To avoid races between message create and send the SDK first collects all information about the message to create and then creates and sends the message in a single operation.
There are two major types of messages: TEXT and MEDIA.
Options com.twilio.chat.Message.Options.withAttributes | ( | Attributes | attributes | ) |
Set new message attributes.
attributes | Attributes for the message. |
Options com.twilio.chat.Message.Options.withBody | ( | String | body | ) |
Create message with given body text.
If you specify withBody() then you will not be able to specify withMedia() because they are mutually exclusive message types. Created message type will be Message::Type::TEXT.
body | Message text body. |
Options com.twilio.chat.Message.Options.withMedia | ( | InputStream | in, |
String | mimeType | ||
) |
Create message with given media stream.
If you specify withMedia() then you will not be able to specify withBody because they are mutually exclusive message types. Created message type will be Message.Type#MEDIA.
After media message is sent, other clients are able to request temporary URL to media content by Message::Media::getContentTemporaryUrl() and then download it.
in | Input stream to read media data from. Provided stream could be any subclass of java.io.InputStream including ByteArrayInputStream, so you could upload media from memory or even generate it on the go. |
mimeType | MIME type for the media. Media service supports popular text, picture and video formats. |
IllegalStateException | When attempt is made to set media on a text-only message. |
IllegalArgumentException | When attempt is made to use null input stream. |
Options com.twilio.chat.Message.Options.withMediaFileName | ( | String | filename | ) |
Provide optional filename for media.
filename | [description] |
Options com.twilio.chat.Message.Options.withMediaProgressListener | ( | ProgressListener | listener | ) |
Set upload progress listener for media.
listener | [description] |