Getting INVALID_SENDER on one device while its working with another GCM android

前端 未结 6 599
粉色の甜心
粉色の甜心 2021-02-07 20:27

I am following Android Push Notifications using Google Cloud Messaging (GCM) to implement GCM with my application it was working fine on single device (Galaxy S) wh

6条回答
  •  遥遥无期
    2021-02-07 21:06

    [Adding to @spanjeta's answer:]

    The problem is that it’s not trivial to get the project number, due to Google ever going modifications of the developer console. While Google was kind enough to give developers the possibility to declare a friendly/textual id for their projects, they didn't update the GCM documentation in that this cannot replace project ID in a GCM client. When you do that (give the project a textual name/ID ) - you cannot use it, because you will get an INVALID_SENDER error. You must get the pure numerical project ID somehow.

    So how do you get the project number? You need to get somehow to the old developer console. The following way works (for now): Yo go to The developer console → Your Project → APIS → Google Cloud Messaging for Android → Quota Then a new, old google devloper console tab will be opened with the following URL: https://code.google.com/apis/console/b/0/?noredirect#project:YOUR_PROJECT_NUMBER:quotas

    Then, use YOUR_PROJECT_NUMBER as the GCM SENDER_ID in your app.

提交回复
热议问题