I have an application that uses Google FCM for sending push notifications.
When i send a push notification to a group of users, i get a response of MismatchSenderId
for some of them. Even though, all users have the exact same application. How can some of the users get a success response and others get a MismatchSenderId?
I have researched a lot and made sure I have added all prerequisites that FCM needs.
Any suggestions?
EDIT:
Sample response:
{"multicast_id":5340432438815499122,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
EDIT 2:
Here is the server side sending code (PHP):
$fields = array
(
'to' => $token,
'data' => $data
);
$headers = array
(
'Authorization: key=AIza**************************',
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, true );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode($fields) );
curl_exec( $ch );
curl_close( $ch );
UPDATE:
It seems that the issue has been resolved with the SDK updates. I am using now the latest com.google.firebase:firebase-messaging:9.6.1
, I don't get "MismatchSenderId" anymore.
We spent hours and hours to resolve this issue. What we found that token was being generated using different FCM account settings (google-services.json) and notification was being set using different FCM account. When we synced both it worked like a charm.
what works for me :
I found that the senderId is different from the project number in the FCM console
so I re-downloaded google-services.json and everything works fine
I had the same problem. After hours spending to figure it out, I found this solution:
Hope this will help you. Thanks
You will have a server key something like this AIzaSyDiTEVq4Li1pj7IyraRlyRU9adc-49-KVY available in the Settings section of firebase console console.firebase.google.com/project/project-XXXXXXXXXXXXX/settings/cloudmessaging.
Specify the correct key with your code and try again.
Firebase has upgraded their server keys to new version. Use new keys instead of old one.
Maybe it will work
check gcm_sender_id in manifest.json If mismatch - correct, but you need make new subscribers for new sender Id. Exists subscribers break.