我需要Google云消息示例应用程序。用示例服务器来测试我的应用程序。谁可以帮我这个事?Google Cloud messaging - 示例服务器
我需要一个样本服务器来测试我的代码,我已经编写了代码,但我不知道它是否会工作。我不知道服务器端编码,所以任何人都可以帮助我。这里是我的代码
意图服务
package com.example.pushnotificationsample;
import android.content.Context;
public class GCMIntentService extends GCMBaseIntentService {
protected GCMIntentService(String senderId) {
super(senderId);
// TODO Auto-generated constructor stub
}
@Override
protected void onError(Context arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onMessage(Context arg0, Intent msgIntent) {
// TODO Auto-generated method stub
Log.d("GCM", "RECIEVED A MESSAGE");
// String msg=msgIntent.getStringExtra("Message");
Log.d("GCM", msgIntent.toString());
// Get the data from intent and send to notificaion bar
}
@Override
protected void onRegistered(Context arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onUnregistered(Context arg0, String arg1) {
// TODO Auto-generated method stub
}
}
我的主要活动
package com.example.pushnotificationsample;
import android.app.Activity;
import com.google.android.gcm.GCMRegistrar;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GCMRegistrar.checkDevice(this);
// GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, "555817657362");
Log.v("Msg", "registered");
} else {
Log.v("Msg", "Already registered");
}
}
}
亲爱的,如果你已经下载了“从SDK管理器GCM包”,那么有客户端,服务器的样本。只需检查** android-sdk/extras/google/GCM **目录 – 2012-07-13 04:46:27
Tnx很多Paresh – Dinu 2012-07-13 05:24:36
@PareshMayani http://chat.stackoverflow.com/transcript/message/4508859#4508859但无法在sdk manager中找到extras文件夹 – Khan 2012-07-13 05:36:45