Send C2DM Message

1.6k views Asked by At

Hello I want to send a C2DM message. To receive the message I use the Chrome to Phone application which I download from http://code.google.com/p/chrometophone/source/checkout There I change the sender id to another gmail id which I used to sign up this application (role account used for sending messages). And also get the auth token and registration id for the same mail id using the android code which I download from above. But when I am sending c2dm message using curl as shown below it return 401 error and says that Unauthorized. Can some one help me to pointing out where I am making wrong.

curl --header "Authorization: GoogleLogin auth=**authFromRegistrationAbove**" "https://android.apis.google.com/c2dm/send" -d registration_id=**phoneRegistrationId(reciever)** -d "data.message=Hello" -d collapse_key=message -k
1

There are 1 answers

1
Mickey Kawick On

Your server needs authorization. Have you registered yourself with Google? You need to sign up with them to receive registration IDs when a user logs into his/her device.

Here is that error code from the docs: 401 Indicates that the ClientLogin AUTH_TOKEN used to validate the sender is invalid.