call.sendReaction(
type = "default",
emoji = ":fireworks:",
custom = mapOf(Pair("yourCustomKey", "customStringValue"))
)
Custom Data
Custom data is additional information that can be added to the default data of Stream. It is a dictionary of key-value pairs that can be attached to users, events, and pretty much almost every domain model in the Stream SDK.
On Android, custom data is represented as Map<String, Any?>
where the Any
value can be a String, Integer, Double, Long, Boolean, List, Map or null. The values inside the lists and maps can also only contain the listed types. Custom classes are not supported and we recommend to convert your custom object to a JSON String.
Adding Custom Data
Adding extra data can be done through the Server-Side SDKs or through the Client SDKs. In the Android Stream Video SDK, you can add extra data when creating/updating a user, event, reaction and other models. As a simple example, let’s see how you can add a new custom field to a Video Reaction.
Reading Custom Data
All of the most important domain models in the SDK have an customData
property that you can read the additional information added by your app.
The following code snippet shows how to get an email from a user’s custom data.
val email = user.custom["email"]