Implementation of FCM with XMPP using Smack for Android
Asked Answered
N

1

9

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.

Netsuke answered 16/12, 2016 at 13:34 Comment(4)
I have the same issue, sometimes i don't even get a disconnected callback. After "reconnection" it doesn't send messages to FCM.Sogdiana
i am also facing same problem. please helpIcelandic
i am suffering the same. Anyone help please.Whimsey
Hey, im having issues regarding setting up smack and fcm xmpp in the first please. I cant find a documentation anywhere.Ewan
C
-1
  • 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

Costanzia answered 20/7, 2017 at 19:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.