Question

I have created 3 activities. First is loginactivity to check login details.After Login is successfull it jumps to displayactivity which i used to show contacts of a person in a listview.After selecting any contact from listview it jumps to 3 activity which is messageactivity to show the chatting between 2 users. Now my question is Every time i open messageactivity from displayactivity. When I try to send Message from messageActivity using ChatManager it creates a new listener for that particular user.But i have also created a one different message Listener. Now what happens: 1. When i starts application it creates listener to listen to messages. 2. When i try to send message it creates another listener for that particular user.

So, it starts duplicating messages? Any Idea. Where i am wrong I am new in XMPP and Android Please help.

Était-ce utile?

La solution

You should use only one packet listener in service, then send broadcast from that service when xmpp message is received, who so ever Activity want that message can use it after that

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top