The example provided by Firebase is:
Your Android app can send an upstream message using
FirebaseMessaging.send
: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") .build());
1:
They've explained what the Message ID is:
A message ID that should be unique for each sender ID.
However, I didn't get what they mean in precise. So, every time I send a message, this number gets incremented? For what reason? And where do I store this value?
2:
They also have the method addData()
, and I don't fully understand this what this does. A full, detailed explanation on this method will be accepted.