I am trying to set up FCM functionalities into my app. At the moment, I would like to display a button such that when the user presses the button an upstream message is generated which is sent to Google's CCS. It is my understanding that this upstream message will be turned into an XMPP stanza by the Google CCS. Then, it will be delivered to the phone that has the id I set to when creating the upstream message. After reading the documentation on FCM from google, I see that it is very simple to create an upstream message:
FirebaseMessaging fm = FirebaseMessaging.getInstance();
fm.send(new RemoteMessage.Builder(SENDER_ID + "@gcm.googleapis.com")
.setMessageId(Integer.toString(msgId.incrementAndGet()))
.addData("my_message", "Hello World")
.addData("my_action","SAY_HELLO")
.addData()//somewhere in here must be a way to set the senderId of the phone
// i am trying to send the message to ???
.build());
Now by looking at the code above, i see in no way XMPP being used to create this upstream message. No XMPP stanza creation. My question deals with where does this XMPP stanza be delivered to? Once it leaves Google's CCS. I see a method on the class that extends FirebaseMessagingService called onMessageReceived. It is my understanding that in this method is where the XMPP stanza will be delievered. Or, will it be delivered on the Smack library connection I intend to set up which will have a PacketListener. According to the example by "Gronkking Android", Google's CCS XMPP stanzas will be delivered here on this packetlistener. I do intend to follow this example to receive these coming stanzas and generate the required ack messages.
If anyone has any thoughts or ideas it would be great to hear your comments
Thank you