File sharing is a feature that allows users to send files during a chat, such as images, audio files, and videos. File sharing appears in the message input field region of the
In UIKit for Android, there are currently four types of file messages that users can send: image file, video file, audio file, and document file. These files can be shared with other participants in the channel by either directly taking a photo with the camera on a mobile device or uploading an image, video, audio, or document file from the sender’s mobile device.
Note : In order to use the file sharing feature, you must first create a channel and enable chat service. To learn how to allow users to chat in a channel, refer to Chat in a channel.
You can customize the UI for file sharing using
To customize the style of channel items, you have to change the UIKit-defined style values in the
res/values/styles.xml file as shown below.
The size, color, font, and style of text in file messages.
The shape and color of message bubbles containing a file in a chat view.
The following table shows customizable file sharing icons.
An icon used to select and add files.
An icon used to select a file to send.
An icon indicating an audio file message.
An icon indicating a document file message.
An icon indicating a
An icon indicating a video file message.
UIKit for Android allows users to compress images when sending them to other users in the channel on a client app. By reducing the image size, they can send and receive image files faster and minimize the usage of data storage as well as the data usage. Image compression can be applied to the following image types:
The following table lists methods in the
SendBirdUIKit instance that are related to image compression.
Determines whether to compress the image when sending an image file message. This method only applies to the following image types:
Retrieves the set value of
Sets the value of the compression rate to apply to the image. Acceptable values are 0 to 100, inclusive. (Default: 100)
Retrieves the set value of the compression rate to apply to the image.
Sets the new
Retrieves the resized
Note: To compress an image without changing the
height, use the
setCompressQuality()method. To resize the
heightof an image, use the