How to disconnect user from sendPrivateChat ?

0 votes
I am making chat application and i am using sendPrivateChat method to communicate user in private mode. but i want to disconnect user when user press back button of android device. so can you please tell me how to disconnect user from private chat mode. ? i have used appwrap service in android. Thanks in Advance.
asked Sep 28, 2016 in Android by bhavesh (16 points)

1 Answer

0 votes

HI Bhavesh,

Greetings!!

You can use disConnect API to disconnect user from AppWarp on back button event.But it will disConenct  the respective user.

But If you want to disable private chat option only without disConnecting the user, in this case you need to write own businees login. You can manage a flag in Shared Pref and can enable the private Chat mode accordingly.

Let me know if it helps.

Thanks

Vishnu Garg

answered Sep 28, 2016 by Vishnu Garg (674 points)
i already put log in onPrivateChatReceived and application display log twice
is there any way to close private chat between two user when user press back button ?
So you are getting the twice message when application opens again?Or you are opening again and again and you will be getting the same message again. Is it happening while resume pause in a little period of time.The only way is disConnect API
are you saying i have to call   theclient.disconnect() ?
Yes,You need to call DisConnect API, so that if your application is background it disconnect the user from server.
ok Thanks
can you please tell me what is the reason for null pointer exception
 though i have check event!=null i am getting null pointer exception in
 event.getJoinedUsers().length
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...