Android GCM send and MismatchSenderId

后端 未结 4 1054
灰色年华
灰色年华 2021-01-23 08:46

The odd thing is that notifications were working before. So I\'m not sure what happened. I tried reinstalling my app to the device, but nothing changed.

{\"multi         


        
4条回答
  •  北海茫月
    2021-01-23 09:14

    I think it must be something to do with the way you have set up API access for your project in the Google APIs console, in particular the 'allowed referers'. As the dev docs say

    Mismatched Sender A registration ID is tied to a certain group of senders. When an application registers for GCM usage, it must specify which senders are allowed to send messages. Make sure you're using one of those when trying to send messages to the device. If you switch to a different sender, the existing registration IDs won't work. Happens when error code is MismatchSenderId.

    My project is set up to allow any referer like:

    Key for browser apps (with referers) 
    API key: my secret  
    Referers: Any referer allowed
    

    Perhaps you have restricted it to a certain IP range, and now you are trying to send the message from outside that range

提交回复
热议问题