Android GCM SENDER_ID, how to get it?

前端 未结 10 1722
温柔的废话
温柔的废话 2020-12-01 02:19

I try to migrate to GCM and I have an issue with the SENDER_ID I need to provide. I use the demo project from google. In this project I need, if I

相关标签:
10条回答
  • 2020-12-01 03:11

    If you came here because you are doing web push, Android push, or the like, there is a different answer.

    Source: https://firebase.google.com/docs/cloud-messaging/js/client

    0 讨论(0)
  • 2020-12-01 03:12

    Go to your Google APIs Console page. Select the project you use from the drop down menu on the left. Select Overview and now you can see you project number. It is the SENDER_ID you have to use

    Another way to get your project number is to get the value of "project" from your url. Your url has to be like this: "https://code.google.com/apis/console/b/0/#project:886025556782". Here the project number is "886025556782". this number is SENDER_ID

    0 讨论(0)
  • 2020-12-01 03:15

    Yet another updated answer with little more explanation for the confused(..like I was).(with due credit to @azgolfer, @PankajAndroid and @Adam)

    1- If you create a project at https://console.developers.google.com, you can see two things "PROJECT ID" and "PROJECT NUMBER" in project overview. Project Id is no longer numeric but alpha numeric like master-xxxxx-1234. Project number is a 11 digit number like 123456789100.

    project dashbaord

    2- Even when you inspect the browser link you can find it as: https://console.developers.google.com/project/master-xxxxx-1234

    So is master-xxxxx-1234 is the SENDER_ID (at some places referred as PROJECT ID)? NO.

    You have to use the project number as project id in GCM.

    3- Where can you cross check that project id is being used as project id?

    On API Dashbaord. (url: https://code.google.com/apis/console/b/0/?noredirect#project:12345678900 - where 12345678900 is your project number on project dashboard.

    google api dashboard

    SUMMARY: Project Id in Project Dashboard and API Dashboard are different. The project number in project dashbaord is used as project id in API Dashboard and Project Id in project dashbaord as Project name in API Dashboard. So the project number shown in the Project Dashboard when we create project in developer console is used as SENDER_ID in GCM.

    0 讨论(0)
  • 2020-12-01 03:19

    I have done for Latest Google API Console.

    How to get SenderId:

    Steps:

    1. Open Google api console
    2. Create project
    3. Click on Left hand side menu icon
    4. Click on Google cloud Platform
    5. You would get SenderId form there

    Reference:

    Hope this will help you.

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