yanniks
yanniks

Reputation: 299

GCM demo server - specify message

I'm running the GCM demo server and it works quite well, but there's just one last problem I have: What do I have to do to send a message with content, there's no field for that in the demo server. Or does anyone have another server which I can run on an Apache Tomcat server?

Please help!

Upvotes: 1

Views: 494

Answers (2)

sam
sam

Reputation: 2820

In GCM demo server sample, if you open SendAllMessageServlet.java, you can add your content by modifying line 81.

Message message = new Message.Builder().build();

to

Message message = new Message.Builder().addData("subject", "Hello World").build();

Then, the client can get your content in onMessage() method using intent.getStringExtra("subject");

Upvotes: 0

Jarle Hansen
Jarle Hansen

Reputation: 1993

In the GCMUtils project I have created a test server where you very easily can send messages. It is a simple maven plugin, here is more information: https://code.google.com/p/gcmutils/wiki/MavenPlugin#Test_server

It does not run on tomcat (it uses jetty), but maybe it can be useful if you want to test your gcm client implementation?

Upvotes: 1

Related Questions