Manuel Castro
Manuel Castro

Reputation: 1723

GCM sending message using java

Using nodejs and node-gcm I'm sending message to my android client using this code

var sender = new gcm.Sender('API KEY');
sender.send(message, regId, function(err, result) {
         if (err) console.log("error");
         else console.log("Message sent! :)");

There is something similar on Java? I found this

Sender sender = new Sender(GCM_API_KEY);
try {
        Result res = sender.send(message, "token", 3);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

But with the Java Sender I can't set the client id. How can I do?

Upvotes: 0

Views: 291

Answers (1)

Eran
Eran

Reputation: 393771

There is no client id needed for sending a GCM message with the Sender class. All you need are the API key and the Registration ID (to be placed where you wrote "token").

Upvotes: 1

Related Questions