sendDirectionalMessage

public abstract void sendDirectionalMessage(ConversationType type, String targetId, MessageContent content, Array<String> userIds, String pushContent, String pushData, IRongCallback.ISendMessageCallback callback)

Sends a targeted message.

This method is used to send a message to specific users within a group or ultra group, while other users will not receive this message. The message status and body are returned through the methods in IRongCallback.ISendMessageCallback. This method can only send non-multimedia messages. For multimedia messages such as , FileMessage, or other messages inherited from , use sendDirectionalMediaMessage. If you are using IMLib, you can use this method to send targeted messages. If you are using IMKit, please use the method with the same name in RongIM to send targeted messages; otherwise, the UI will not be updated automatically.

Starting from version 5.6.9, ultra group conversation types are supported.

Parameters

type

The conversation type.

targetId

The conversation ID, which could be a group ID or ultra group ID.

content

The message content, such as TextMessage or ImageMessage.

pushContent

When sending a remote push notification, this field will be displayed in the notification bar. If you are sending a custom message, this field must be filled in; otherwise, the remote push notification will not be received. For default message types in the SDK, such as RC:TxtMsg, RC:VcMsg, RC:ImgMsg, this field does not need to be filled in as it is already specified by default.

pushData

Additional information for the remote push notification. If this field is set, users can retrieve it via getPushData when they receive the remote push notification.

userIds

The list of users in the discussion group or group conversation who will receive this message.

callback

The callback for sending the message, refer to .