title: Implementation of FCM with XMPP using Smack for Android
body: <p>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.</p>
  
  <ol>
  <li>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</li>
  <li>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.</li>
  <li>I am unable to get the presence of the User on other side during chatting.</li>
  </ol>
  
  <p>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.</p>