Skip to content

Instantly share code, notes, and snippets.

@bookercodes
Created July 11, 2019 17:02
Show Gist options
  • Save bookercodes/60d8043f093d11dbe80962ac17012b12 to your computer and use it in GitHub Desktop.
Save bookercodes/60d8043f093d11dbe80962ac17012b12 to your computer and use it in GitHub Desktop.
CometChat.init(this, "APP_ID", object : CometChat.CallbackListener<String>() {
override fun onSuccess(p0: String?) {
Log.d(TAG, "Initialization completed successfully")
}
})
CometChat.login("bendewberry", object : CometChat.CallbackListener<User>() {
override fun onSuccess(p0: User?) {
Log.d(TAG, "Login Successful : " + p0?.toString())
}
})
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", object : CometChat.MessageListener() {
override fun onTextMessageReceived(p0: TextMessage?) {
Log.d(TAG, "Message received successfully: " + p0?.toString())
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment