如何创建Android中GCM项目服务器 [英] How to create server for GCM project in Android

查看:112
本文介绍了如何创建Android中GCM项目服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的谷歌云消息(GCM)项目和我下面的本教程

I am creating a project on Google Cloud Messaging (GCM) and am following this tutorial.

我正在与客户端完成工作,并设置在客户端的设备。此外,我一直在使用下面的code注册的设备。

I am done with the client-side work and set up the device on the client side. Also I had registered the device using the following code.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this);
    final String regId = GCMRegistrar.getRegistrationId(this);
    if (regId.equals("")) {
        GCMRegistrar.register(this, "483910217912");
        Log.d(tag, "Registered");
    }
    else {
        Log.v(tag, "Already registered");
    }
}

现在我被困在一个点为我的GCM项目创建服务器。请注意,我创建一个项目收到新邮件时通知。但是,我没有实现的服务收到的消息,但我会实现它在服务器设置完成。

Now I am stuck at a point to create server for my GCM project. Note that I am creating a project to notify when a new message is received. However, I had not implemented the service to receive a message, but I will implement it when the server setting is finished.

推荐答案

您可以找到样本code为在Android SDK目录GCM客户端和GCM服务器。这是好点开始。目录是:

You can find sample code for gcm-client and gcm-server in the Android SDK directory. It is good point to get started. Directory is :

path_to_android_sdk /演员/谷歌/ GCM /样本

path_to_android_sdk/extras/google/gcm/samples

这篇关于如何创建Android中GCM项目服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆