This is regarding a migration from Firebase client version 6 to 7.
In the past, we called .getException().getErrorCode()
on an instance of com.google.firebase.messaging.SendResponse
.
We handled two cases specifically, "registration-token-not-registered"
and "mismatched-credential"
.
Since version 7, there are two different error codes that can be retrieved, one with .getException().getErrorCode()
(returning an generic ErrorCode
) and .getException.getMessagingErrorCode()
(returning a more fitting MessagingErrorCode
).
The migration guide to version 7 clearly shows that the first case of "registration-token-not-registered"
can now be handled with .getException.getMessagingErrorCode()
and matching against MessagingErrorCode.UNREGISTERED
, but the case of "mismatched-credential"
(and all other possible errors) isn't documented anywhere.
The best thing I could find is the documentation of the enum.
But I am not sure if
The credential used to authenticate this SDK does not have permission to send messages to the device corresponding to the provided registration token
(from the Admin Error codes documentation) and
The authenticated sender ID is different from the sender ID for the registration token.
(from the documentation of the enum MessagingErrorCode.SENDER_ID_MISMATCH
) means the same...
My question is twofold:
- Is there a nice way to relate
MessagingErrorCode
s to the actual Admin error codes? - Is the
MessagingErrorCode.SENDER_ID_MISMATCH
the right error code for"mismatched-credential"
?