With the Firebase Android SDK 9.4, this problem was resolved
From the release note :
FIXED RemoteMessage#getMessageId() now returns the correct message identifier for received messages. Previously, it returned null .
An update to the com.google.firebase:firebase-messaging dependency on version 9.4.0 really 9.4.0 problem.
Update 2.07.2016: I was informed that this is really a bug, and the fix will be included in the next release.
It turns out we cannot get the message id on the application side. I asked for Firebase support for help, and here is what they told me:
When FCM successfully receives the request, it will try to deliver all the signed devices, FCM will return a response that includes the messageID to your server. You cannot directly receive a MessageID on your client side (Android device). MessageID is a parameter in the response payload.
As a workaround, I generate custom message identifiers on the server and passing them to the payload.
What RemoteMessage.getMessageId () really does remains a mystery.
source share