Skip to main content

For private chat, the SDK supports sending end-to-end encrypted messages.

End-to-end encryption uses Signal's open-source encryption protocol so that messages can be viewed only by the sender and recipient. No other node on the transmission path can decrypt the content.

Send messages in the PRIVATE_E2EE conversation type. The SDK encapsulates all internal end-to-end encryption logic and automatically encrypts sent messages and decrypts received messages.

Example

TextMessage text = new TextMessage("Secret message");
Conversation conversation = new Conversation(Conversation.ConversationType.PRIVATE_E2EE, "userid1");
IMessageManager.ISendMessageCallback callback = new IMessageManager.ISendMessageCallback() {
@Override
public void onSuccess(Message message) {
Log.i("TAG", "send message success");
}

@Override
public void onError(Message message, int errorCode) {
Log.i("TAG", "send message error, code is " + errorCode);
}
};
Message message = JIM.getInstance().getMessageManager().sendMessage(text, conversation, callback);