Created
January 25, 2015 20:04
-
-
Save leonardocordeiro/808119c7b1dbe1f95187 to your computer and use it in GitHub Desktop.
GCM Server-side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.caelum.gcm; | |
import java.io.IOException; | |
import com.google.android.gcm.server.Message; | |
import com.google.android.gcm.server.Sender; | |
public class EnviarMensagem { | |
private static final String API_KEY = ""; | |
private static final String DEVICE_ID = ""; | |
public static void main(String[] args) throws IOException { | |
System.out.println("Enviando mensagem..."); | |
Message message = new Message.Builder() | |
.addData("message", "Olá") | |
.build(); | |
Sender sender = new Sender(API_KEY); | |
sender.send(message, DEVICE_ID, 5); | |
System.out.println("Enviada!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment