use of com.avos.avoscloud.im.v2.messages.AVIMTextMessage in project ride-read-android by Ride-Read.
the class MessageHandler method sendNotification.
private void sendNotification(AVIMTypedMessage message, AVIMConversation conversation) {
String notificationContent = message instanceof AVIMTextMessage ? ((AVIMTextMessage) message).getText() : context.getString(R.string.nonsupport_message_type);
Intent intent = new Intent(context, NotificationBroadcastReceiver.class);
intent.putExtra(Constants.CONVERSATION_ID, conversation.getConversationId());
intent.putExtra(Constants.MEMBER_ID, message.getFrom());
NotificationUtils.showNotification(context, "", notificationContent, null, intent);
}
use of com.avos.avoscloud.im.v2.messages.AVIMTextMessage in project ride-read-android by Ride-Read.
the class ChatActivity method onEvent.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ImTypeMessageEvent event) {
if (null != imConversation && null != event && imConversation.getConversationId().equals(event.conversation.getConversationId())) {
if (event.message instanceof AVIMTextMessage) {
String msg = ((AVIMTextMessage) event.message).getText();
ChatMessage chatMessage = new ChatMessage(0, R.mipmap.me, menberId, msg, null);
adapter.addMessage(chatMessage);
adapter.notifyDataSetChanged();
chatlist.smoothScrollToPosition(adapter.getCount() - 1);
}
}
}
Aggregations