9
votes

I am working with XMPP for implementing chat in my Android application and i have used Smack API for it. My Chat is working fine and i am saving all the chat messages on Android Device locally.Following are some problems that i am currently facing.

  1. During Chat if somehow connection lost then it takes to much time to reconnect again and sometimes it dont even gets connected. Even after the connection is connected, It stop sending chat message as it is not receiving on other side anymore.I have initialized the resources again but it works sometimes
  2. I want to use FCM to send message if my USER is disconnected (offline). I have implemented FCM for other things and its working fine. But i want to know how do i use FCM with SMACK API if user on otherside is offline. I am trying but i don't know the proper way of FCM implementation with XMPP.
  3. I am unable to get the presence of the User on other side during chatting.

Please suggest me the proper way of XMPP(openfire) smack implementation. So, that it works seamlessly like whatsapp. User gets connected immediately after internet reconnected or Activity open as new instance etc. Its 1 to 1 chat i.e only two users gets connected at a time. Thanks in advance and please don't downgrade my question as i am new in XMPP implementation.

1
I have the same issue, sometimes i don't even get a disconnected callback. After "reconnection" it doesn't send messages to FCM.Manish Patel
i am also facing same problem. please helpRajinder
i am suffering the same. Anyone help please.Sunny Sharma
Hey, im having issues regarding setting up smack and fcm xmpp in the first please. I cant find a documentation anywhere.because_im_batman

1 Answers

-1
votes
  • For connection lost you should define broadcast receiver and when connection is down close connection to openfire and when it comes up reconnect again make sure you connected and authorized.

  • For offline user this is server side as the following when user send message to open fire check if the end user online then it forwards message to him and if it is offline it will save message in database and if end user comes up open fire ask fire base to send it to the end user