12

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) when i tried to test it with another device( Galaxy Tab 7') its generating error.

handleRegistration: registrationId = null, error = INVALID_SENDER, unregistered = null

here is the Log which i am getting

V/GCMRegistrar(5649): Registering app  my_maypackage of senders APA91bHvzZbO_nyYvaA_QRGDaV-wRAYKjt0qJSQmzPUi2unqG7j0OGuyhVY1A3zh-ZfnA0XT0ffgyKypVJ_5owLZvZBNGARpTBkBg9ED8gVVCDejaIpShghq_tXGhMnFQEufwdCL1ibm
V/GCMRegistrar(5649): Setting registeredOnServer status as true until 2013-04-02 11:02:07.847

V/GCMBroadcastReceiver(5649): onReceive: com.google.android.c2dm.intent.REGISTRATION
V/GCMBroadcastReceiver(5649): GCM IntentService class: my_maypackage.GCMIntentService
V/GCMBaseIntentService(5649): Acquiring wakelock
V/GCMBaseIntentService(5649): Intent service name: GCMIntentService-980172650021-7

D/GCMBaseIntentService(5649): handleRegistration: registrationId = null, error = INVALID_SENDER, unregistered = null
D/GCMBaseIntentService(5649): Registration error: INVALID_SENDER
I/GCMIntentService(5649): Received error: INVALID_SENDER
V/GCMBaseIntentService(5649): Releasing wakelock

Note: both devices are configured with same gmail account.

amDroid
  • 131
  • 1
  • 1
  • 6

6 Answers6

21

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.

Shiv
  • 1,269
  • 11
  • 20
  • DAMN IT........ I was using the 'project ID' which was text based in the url, this might be how the url is written in the new API console. Gah!!! All fixed now thanks :) – GONeale Feb 17 '14 at 06:18
  • So where do you project id as number. My is text based like vigilant-brace-234. Or should I use this one? – Mando Jul 26 '14 at 20:42
  • Ok, I found a way to get the numeric project id - just go to the classic (original) console and it's still there! – Mando Jul 26 '14 at 20:49
  • 1
    Project ID is also available on the new console, under the main dashboard section. – Giovanni Toraldo Nov 18 '14 at 13:21
  • I'm getting INVALID_SENDER despite I have the correct sender Id, you know any other reason why I'm getting it? – Jorge Arimany Apr 22 '17 at 01:16
14

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

s1m3n
  • 623
  • 6
  • 21
6

[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.

Ron Munitz
  • 161
  • 2
  • 3
2

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!

MonkeyDL
  • 21
  • 2
2

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.

CoPLaS
  • 1,727
  • 12
  • 21
1

maybe you need change the GOOGLE_PROJ_ID

First

enter image description here

Second enter image description here

Good Luck!!

David Hackro
  • 3,652
  • 6
  • 41
  • 61