Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sendReply(String message)
- {
- db.open();
- long frmUserId=ConstantValues.myUserId;
- db.insertNewChat(thisPostId, message, frmUserId, ConstantValues.isWebsiteReachable);
- db.close();
- String frmUserName=ConstantValues.myUserName;
- chatAdapter.add(new ChatMessage(false, message, frmUserName, ConstantValues.isWebsiteReachable));
- chatAdapter.notifyDataSetChanged();
- if (ConstantValues.isWebsiteReachable) {
- sendPostReply(message);
- }
- }
- private boolean sendPostReply(String textMessage){
- MyChat chat = new MyChat();
- chat.chatMessage=textMessage;
- chat.postedBy = ConstantValues.myUserId;
- chat.postId = thisPostId;
- chat.postedAt= Calendar.getInstance().getTime().toString();
- Gson gson = new Gson();
- String chatBody = gson.toJson(chat);
- String node = "node_p_"+thisPostId;
- CharSequence sq ="<chat xmlns='pubsub:cues'>"+chatBody+"</chat>";
- ActivityHome.getmService().xmpp.publishToPubSubNode(node,sq);
- Log.i("send message ", ": message : " + textMessage+" char sequence =:: "+sq);
- return true;
- }
Add Comment
Please, Sign In to add comment