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

前端 未结 6 610
粉色の甜心
粉色の甜心 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

    maybe you need change the GOOGLE_PROJ_ID

    First

    Second

    Good Luck!!

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-07 21:07

    Log is showing incorrect sender ID. it should be taken from Google api project url. e.g

    https://code.google.com/apis/console/b/0/#project:65464654646546

    then 65464654646546 is sender ID.

    0 讨论(0)
  • 2021-02-07 21:11

    There is a project ID and the Project Number shown on the top of the Project Dashboard.

    Project ID: aaaa-bbb-000000 Project Number: 00000111112
    

    You have to use the numeric Project Number as SENDER_ID.

    0 讨论(0)
  • 2021-02-07 21:24

    For me what did it was enabling the "Google Cloud Messaging for Android" from the Console's API section: enter image description here

    0 讨论(0)
  • 2021-02-07 21:24

    I just wanted to share with you that I ran into this same problem just now.

    GCM push worked perfectly fine before, nothing's got changed, and all of the sudden our users flushed back with complaints about not getting push notifications.

    So I did check out all the StackOverflow thread re. this issue and still couldn't figure things out (had the app id / keys all correctly input, code's perfectly fine, even tried out on the Google demo and blah blah blah)

    So in an act of desperate I went to the dev console and disabled GCM, then re-enabled it... everything just worked!

    0 讨论(0)
提交回复
热议问题