Problem
I keep getting a “No authentication challenges found” IOException error when I try to send a Google Cloud Messaging message.
What
I am trying to send the message from an Android phone using the gcm-server.jar file in the GCM SDK package. I based my code off the server example in the GCM documentation.
Sender sender = new Sender(MyProjectId);
Builder message = new Message.Builder();
message.collapseKey("test");
message.addData("test", "42");
Message data = message.build();
Result result = null;
try {
result = sender.send(data, deviceID, 5);
} catch(IOException e) {
Log.e("GCM Error", e.getMessage());
}
Other Info
I am trying to send push messages from device to device without the need of a “third party” server to get involved. I am not sure if it is even possible to use an Android phone to push out messages through GCM.
Any help or pointers will be greatly appreciated.
So it looks like my code was not wrong. I was using the wrong API id from my apis account. Everything is working now.