Closed dengxiaoyu closed 2 years ago
/**
文本消息 */ val v2: Message = OpenIMClient.getInstance().messageManager.createTextMessage(binding.etChat.text.toString() + "") sendMessage(v2)
/**
发送消息的方法 */ fun sendMessage(v2: Message) { OpenIMClient.getInstance().messageManager.sendMessage( object : OnMsgSendCallback { override fun onError(code: Long, error: String?) { Log.e("IM发送失败", "onError: code" + Gson().toJson(code) + "/" + error) if (208 == code.toInt()) { ToastUtils.show(this@ChatDeatailPageActivity.resources.getString(R.string.groupnotexist)) } }
@SuppressLint("NotifyDataSetChanged")
override fun onSuccess(s: String?) {
binding.etChat.setText("")
chatlist.add(v2)
chatDetailPage!!.notifyDataSetChanged()
binding.recyclerChatDetail.scrollToPosition(chatDetailPage!!.itemCount - 1)
setNoReadMessageList(chatlist)//设置消息是否已读的
}
override fun onProgress(progress: Long) {
}
}, v2, uid, null, false
) }
错误码是201 错误信息 是 kafka send msg err