FCM 獲取 MismatchSenderId - FCM getting MismatchSenderId

問題:

I have an application that uses Google FCM for sending push notifications.我有一個使用 Google FCM 發送推送通知的應用程序。

When i send a push notification to a group of users, i get a response of MismatchSenderId for some of them.當我向一組用戶發送推送通知時,我會收到其中一些用戶的MismatchSenderId響應。 Even though, all users have the exact same application.儘管如此,所有用戶都擁有完全相同的應用程序。 How can some of the users get a success response and others get a MismatchSenderId?一些用戶如何獲得成功響應而其他用戶獲得 MismatchSenderId?

I have researched a lot and made sure I have added all prerequisites that FCM needs.我進行了大量研究,並確保已添加 FCM 所需的所有先決條件。

Any suggestions?有什麼建議?

EDIT:編輯:

Sample response:示例響應:

{"multicast_id":5340432438815499122,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}

EDIT 2:編輯2:

Here is the server side sending code (PHP):這是服務器端發送代碼(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.似乎該問題已通過 SDK 更新解決。 I am using now the latest com.google.firebase:firebase-messaging:9.6.1 , I don't get "MismatchSenderId" anymore.我現在正在使用最新的com.google.firebase:firebase-messaging:9.6.1 ,我不再收到“MismatchSenderId”。


解決方案:

參考: https://stackoom.com/en/question/2YrvG
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章