Reputation: 962
I am having trouble testing out push notifications using the C2DM service.
I am using Lars' example until "3.4. Register your application" to set up my android test project. I successfully get the Registration ID from the device.
Then I successfully get the Auth token via my server using the following curl:
curl https://www.google.com/accounts/ClientLogin -d Email=theEmailYouWhitelisted -d Passwd=pass****word -d accountType=HOSTED_OR_GOOGLE -d source=Google-cURL-Example -d service=ac2dm
So now I have the two main components to push. So for the purpose of testing I issue another curl to send a message (I am going to implement the auth token generation, and sending of message in php once I get it functional).
I use:
curl --header "Authorization: GoogleLogin auth=**authFromRegistrationAbove**" "https://android.apis.google.com/c2dm/send" -d registration_id=**phoneRegistrationId(reciever)** -d "data.message=HelloPush" -d collapse_key=something -k
Response:
Error=NotRegistered
This is where I am, and confused. I successfully got my Auth Token using my white listed email / pw registered and accepted into the C2DM program via my client server. Then compiled Lars' project to generate my devices registration id, but once they are used together I get the not registered error above, and no push notification.
Ideas? Comment if you need anymore information and I'll update the post. Thanks.
Upvotes: 2
Views: 3763
Reputation: 26362
If you follow me example you should maintain your registered C2DM user (Email address) in the Text Field in RegisterActivity.This must be the same as in the CURL thing. Also make sure you copy the authentication string correctly.
Upvotes: 4
Reputation: 2772
Did you see check this previous question already? This problem is also frequently discussed on the android-c2dm
mailing list. Here's a search for NotRegistered
.
A common problem is that you are not using the same sender ID on the application as the one you used to generate the auth token. Note that in the C2DM signup form, there are two email addresses you provide: one is just to notify you when you're accepted, and the other is the "Role Account". The latter is also known as the sender ID and is what must be used on the phone application and for the account used to generate the auth token.
Upvotes: 2