GCM API key vs Sender ID

后端 未结 4 1827
灰色年华
灰色年华 2021-02-04 07:19

I am confused about GCM Sender ID and API key. I\'m responsible for building 3rd party server that will send notifications to Android app.

Which one do I have to store o

4条回答
  •  野的像风
    2021-02-04 07:43

    It depends on how your thirds party server is going to work, but in general it works like this:

    1. The app sends one or more sender Ids which are Google Project Numbers to the GCM servers.
    2. GCM returns a registration Id, which the app uses to register with the server.
    3. The server uses the registration Id and the API key to send a message to the device via GCM.
    4. When sending the message GCM will ensure that the Google Project Number and API key match and match what was used to create the registration Id. If they do it sends the message.

    Information on how the developers get this information can be found in the GCM documentation: http://developer.android.com/google/gcm/gs.html

    Depending on your needs there are third party commercial sever solutions available.

提交回复
热议问题