-2

I m developing android chat app using asmack api with quickblox.

I'm facing problem that in peer to peer chat, i also receive 3rd user chat message in my peer chat.

Any hint or help is appreciated.

Thanks

Vikalp Patel
  • 10,669
  • 6
  • 61
  • 96
Vyoma
  • 65
  • 7

2 Answers2

2

In the OnMessageReceivedListener check for message received id

String messageString = message.getBody();
  String test=message.getFrom();
  if((friendID+"/Smack").equals(message.getFrom()))
  {

  }

where friend-ID is the id , to which you are connected.

Manish Dubey
  • 4,206
  • 8
  • 36
  • 65
Sachin Arora
  • 426
  • 4
  • 6
  • 1
    private MyChatController.OnMessageReceivedListener onMessageReceivedListener = new JoinRoom.OnMessageReceivedListener() { @Override public void onMessageReceived(final Message message) { String messageString = message.getBody(); String test=message.getFrom(); if((messageFrom+"/Smack").equals(message.getFrom())) { showMessage(messageString, false); } }; – Sachin Arora Mar 21 '13 at 09:51
  • Thanks Igor, Please don't forget to mark the answer if will work. – Sachin Arora Mar 26 '13 at 11:06
0

You have to check to which user this message and filter if this message from other users, but not from you current opponent

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • As i m new to android asmack api, quickblox and chating concept. Pls can u guide me proper way of implementation for same. I followed Quickblox demo app but regarding this problem, i coudnt get any hint. – Vyoma Mar 15 '13 at 05:56
  • I need to develop peer to peer chat application. just like whatsapp. Where i can see my friends in list n if chat window is not open then in list & during chat with X user in chat window only X user's message at a time. – Vyoma Mar 15 '13 at 13:20