amDroid
amDroid

Reputation: 131

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

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.

Upvotes: 12

Views: 12909

Answers (6)

David Hackro
David Hackro

Reputation: 3712

maybe you need change the GOOGLE_PROJ_ID

First

enter image description here

Second enter image description here

Good Luck!!

Upvotes: 1

CoPLaS
CoPLaS

Reputation: 1727

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.

Upvotes: 2

Ron Munitz
Ron Munitz

Reputation: 171

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

Upvotes: 6

MonkeyDL
MonkeyDL

Reputation: 21

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!

Upvotes: 2

s1m3n
s1m3n

Reputation: 623

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

Upvotes: 14

Shiv
Shiv

Reputation: 1267

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.

Upvotes: 21

Related Questions