Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GCM SENDER_ID, how to get it?

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 understand this well, to provide a SENDER_ID to the application in the CommonUtilities.java file.

The SENDER_ID I provided is the API key I registered on https://code.google.com/apis/console/ and has this form: AIzaSyAxxxxxxx_xxxxxxxxxxxnoGZw (total 40 chars).

Using this string as SENDER_ID I get on "BroadcastReceiver mHandleMessageReceiver" an error message: From GCM: error (INVALID_SENDER)..

Where is the mistake? The string I provide is not the SENDER_ID?

Thank you.

like image 658
Zelter Ady Avatar asked Jul 02 '12 13:07

Zelter Ady


People also ask

What is a GCM message ID key?

Google Cloud Messaging (GCM) Sender ID: A unique numerical value which is created when you configure your Project in the Google Developers Console/ Google Cloud Console.

How can I get GCM?

GCM API Key Then click on Dashboard, followed by “Enable API” on the right. Once done, search for “google cloud messaging” in the text box and click on it. You will be redirected to Google Cloud Messaging overview page, and then just click on “Enable” at the top. Go to “Credentials” tab available in left sidebar.

Is GCM and FCM same?

Firebase Cloud Messaging (FCM), formerly known as Google Cloud Messaging (GCM), is a cross-platform cloud solution for messages and notifications for Android, iOS, and web applications, which as of June 2022 can be used at no cost.


1 Answers

No, the SENDER_ID is the project ID you signed up at Google API console, it should a numeric string. e.g. on your browser URI, you should see this:

https://code.google.com/apis/console/#project:4815162342 

The Sender ID is 4815162342

Updated Answer:

Google has not updated its docs completely. The above answer is old and its based on this documentation and it seems that its still not updated.

According to updated Google docs, it seems that Project Number on Google API Console is used as SENDER ID

like image 64
azgolfer Avatar answered Oct 18 '22 02:10

azgolfer