谷歌云消息样本 [英] Google cloud messaging sample
本文介绍了谷歌云消息样本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
没有人有一个样品GCM服务器端和Android项目? preferably一个教程,说明了一切。
Does anyone have a sample gcm server side and android project? Preferably a tutorial that explains everything.
我试图让纳入样本一看一个,但是我一直没能得到它的工作。
I have tried to have a look at the one included in the sample however I haven't been able to get it work.
我有一个C2DM项目,该项目是双向服务器端和Android,但我不知道如何将其转换为GCM。
I have a c2dm project which works both server side and android, but I don't know how to convert this to gcm.
我会用GCM将邮件推
任何帮助,将AP preciated
any help would be appreciated
推荐答案
只要按照这个的教程
希望这会帮助你。
GCM服务器端(java的code)
GCM SERVER-SIDE (java code)
public class GCMServerJava {
/**
* @param args
*/
public static void main(String[] args) {
Sender sender = new Sender(enter your App id);// app id
Message message = new Message.Builder()
.collapseKey("1")
.timeToLive(3)
.delayWhileIdle(true)
.addData("message",
"this text will be seen in notification bar!!").build();
Result result;
try {
result = sender.send(message,"registration id which client get after registering device with google gcm service", 1);
System.out.println(result.toString());
Message message1 = new Message.Builder()
.build();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
这篇关于谷歌云消息样本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文