Skip to content

Instantly share code, notes, and snippets.

@bookercodes
Last active July 11, 2019 16:31
Show Gist options
  • Save bookercodes/5ef6b6d9db35f911787dde9bd3560d47 to your computer and use it in GitHub Desktop.
Save bookercodes/5ef6b6d9db35f911787dde9bd3560d47 to your computer and use it in GitHub Desktop.
CometChat.init(this, "APP_ID", new CometChat.CallbackListener<String>() {
@Override
public void onSuccess(String successMessage) {
Log.d(TAG, "Initialization completed successfully");
}
});
TextMessage textMessage = new TextMessage(
"#General",
"Hi everyone",
CometChatConstants.MESSAGE_TYPE_TEXT,
CometChatConstants.RECEIVER_TYPE_GROUP);
CometChat.sendMessage(textMessage, new CometChat.CallbackListener<TextMessage>() {
@Override
public void onSuccess(TextMessage textMessage) {
Log.d(TAG, "Message sent successfully: " + textMessage.toString());
}
});
CometChat.addMessageListener("#General", new CometChat.MessageListener() {
@Override
public void onTextMessageReceived(TextMessage textMessage) {
Log.d(TAG, "Text message received successfully: " + textMessage.toString());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment