如何使用 GCM 从 Java 服务器向 Android 应用程序发送通知?

如何使用 GCM 从 Java 服务器向 Android 应用程序发送通知?

问题描述:

我有一个使用 REST Web 服务的简单 Android 应用程序.现在我想使用 GCM 将通知从我的 REST Web 服务发送到 Android 应用程序.

I have my simple Android application which uses REST web service. Now I want to sent notification from my REST web service to Android application using GCM.

这是怎么做的?是否有针对此要求的简单教程?我搜索并找到了 Google API,但我不明白.

How do this? Is there any simple tutorial for this requirement? I searched and found Google API, but I don't understand that.

我为 GCMUtils 项目创建了一个基于 Java 的测试服务器,作为 maven 插件实现:https://code.google.com/p/gcmutils/wiki/MavenPlugin#Test_server

I have created a Java-based test server, implemented as a maven plugin, for the GCMUtils project: https://code.google.com/p/gcmutils/wiki/MavenPlugin#Test_server

这里是源代码:https://github.com/jarlehansen/gcmutils/tree/master/gcm-test-server

maven 插件的来源:https://github.com/jarlehansen/gcmutils/tree/master/gcmutils-maven-plugin

Source for the maven plugin: https://github.com/jarlehansen/gcmutils/tree/master/gcmutils-maven-plugin

也许这可以帮助您入门?

Maybe this can help you get started?