Search in sources :

Example 1 with Sender

use of com.google.android.gcm.server.Sender in project divide by HiddenStage.

the class PushEndpoint method sendMessageToDevice.

private String sendMessageToDevice(String email, String input) throws ServerDAO.DAOException, IOException {
    Credentials user = getUserByEmail(dao, email);
    Sender sender = new Sender(keyManager.getPushKey());
    Message message = new Message.Builder().addData("body", input).build();
    MulticastResult result = sender.send(message, Arrays.asList(user.getPushMessagingKey()), 5);
    System.out.println("Result = " + result);
    return result.toString();
}
Also used : Sender(com.google.android.gcm.server.Sender) Message(com.google.android.gcm.server.Message) MulticastResult(com.google.android.gcm.server.MulticastResult) Credentials(io.divide.shared.transitory.Credentials)

Aggregations

Message (com.google.android.gcm.server.Message)1 MulticastResult (com.google.android.gcm.server.MulticastResult)1 Sender (com.google.android.gcm.server.Sender)1 Credentials (io.divide.shared.transitory.Credentials)1