Package com.google.android.gcm.server

Examples of com.google.android.gcm.server.Sender.send()


      }
    }
    Message message = messageBuilder.build();
    PushResponse pushResponse = new PushResponse();
    try {
      MulticastResult multicastResult = sender.send(message, Lists.newArrayList(registrationIds), 10);
     
      // analyze the results
      for (int i = 0; i < registrationIds.size(); i++) {
        Result result = multicastResult.getResults().get(i);
        Device device = devices.get(i);
View Full Code Here


  private MulticastResult sendMessageToDevice(String apiKey, List<String> devices, String title, String message) {
    Sender sender = new Sender(apiKey);
    Message gcmMessage = new Message.Builder().addData("title", title).addData("message", message).build();
    MulticastResult result = null;
    try {
      result = sender.send(gcmMessage, devices, 3);
    } catch (IOException e) {
      //e.printStackTrace();
      log.severe(e.getMessage());
    }
    return result;
View Full Code Here

      }
    }
    Message gcmMessage = builder.build();
    MulticastResult result = null;
    try {
      result = sender.send(gcmMessage, devices, 3);
    } catch (IOException e) {
      // e.printStackTrace();
      log.severe(e.getMessage());
    }
    return result;
View Full Code Here

                Sender sender = new Sender(myApiKey);
                Message.Builder message = new Message.Builder();
                for (Map.Entry<String, String> entry : data.entrySet()) {
                    message.addData(entry.getKey(), entry.getValue());
                }
                Result result = sender.send(message.build(), registrationId, 5);

                if (result.getMessageId() != null) {
                    String canonicalRegId = result.getCanonicalRegistrationId();
                    if (canonicalRegId != null) {
                        // same device has more than on registration ID: update database
View Full Code Here

        .addData("custom", customData.toString())
        .collapseKey(collapse_key.toString())
        .timeToLive(time_to_live)
        .build();

    sender.send(msg, deviceid , 1);


    // icallbackPush.onError(e.getMessage());

    // icallbackPush.onSuccess();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.