title: Chat App for Android using a XMPP Server and Google Cloud Messaging (or the newer Firebase Cloud Messaging) for Push Notifications
body: <p>I'm developing a Chat App for Android. I have been reading for weeks about XMPP and Google Cloud Messaging (and Firebase Cloud Messaging) and I am still very confused.</p>
  
  <p>Currently, I already setup an XMPP server locally (Ejabberd) and successfully connected my Android App to it using the Smack library.</p>
  
  <p>To my understanding, I need to use GCM or the newer FCM for Push Notifications, so I already created a project in Google Cloud Platform. My Android App can connect to it using the Smack library too (instead of connecting to my XMPP server directly). In my server I have an small Java app that connects to GCM using the Smack library too.</p>
  
  <p>Everything is fine until here. My big confusion is: <strong>How can I use my XMPP server with GCM for Push Notifications?</strong> Every documentation, examples, guides, tutorials I found for server-side implementations just tell me how to connect to GCM but none tell me how to use my XMPP server in conjunction with GCM. <strong>What I'm missing? My Java app just connects to GCM, receive and send messages from and to GCM, but my XMPP server is just sitting there doing nothing. Actually my Android App and server Java App use GCM exclusively, not my XMPP server.</strong></p>
  
  <p>I hope someone can help me to understand this as a whole, I am obviously missing some key elements to achieve this implementation.</p>