Skip to content Skip to sidebar Skip to footer

Accessing /gcm-demo/sendall. Reason: Http Status Code: 401

i am getting the following Error when i try to send a Message: HTTP ERROR 500 Problem accessing /gcm-demo/sendAll. Reason: HTTP Status Code: 401 Caused by: com.google.android.gc

Solution 1:

you can put the following code into the doPost() method before send messages:

import com.google.android.gcm.server.*;

Sendersender=newSender(myApiKey);
Messagemessage=newMessage.Builder().build();
MulticastResultresult= sender.send(message, devices, 5);

Solution 2:

The sender is probably not authorized with google correctly.

Sender sender = new Sender(MY_KEY);

Is MY_KEY the same key that you registered with google ? Replace the API key as shown on the documentation page

Solution 3:

In a text editor, edit the samples/gcm-demo-server/WebContent/WEB-INF/classes/api.key and replace the existing text with the API key obtained above.

http://developer.android.com/google/gcm/demo.html

Post a Comment for "Accessing /gcm-demo/sendall. Reason: Http Status Code: 401"