请帮助我,我一直在浏览这个主题,并仍然堆叠在这个新的GCM
我根据此链接使用GCM Push的上一个项目
HT**://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
但现在,最后一个GCM(C2DM)已被弃用,因此我们不再使用任何GCMRegistrar
在这里,看看这个h**p://developer.android.com/google/gcm/c2dm.html有一条声明"不推荐使用Android Cloud to Device Messaging(C2DM).C2DM服务将继续在短期内维持,但C2DM将不接受新用户,并且不会授予新的配额 "
我用这个链接来学习这个概念
以及我使用的示例:https: //code.google.com/p/gcm/source/browse/#git
我想,我已经遵循了所需的每一步
我已将我的项目引用到谷歌播放服务库
我也将发件人ID更改为我的Google项目编号
我也收到了GCM的RegID
但问题是,每当我点击发送按钮
它从来没有给我任何东西
从谷歌文档示例中,它说它应该回到我的设备ECHO,但它永远不会
我检查了文档中的概念说gcmbroadcastreceiver会收到任何推送到我设备的GCM消息,
所以我试图登录该广播公司的"OnReceive",但它从未显示任何内容
我还尝试使用此文档http://developer.android.com/google/gcm/http.html实现HTTP GCM Server
我收到像这样的响应{"multicast_id":6256370624066466203,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1378114688323559%eab45603f9fd7ecd"}] }
但我的日志从未显示任何内容
这是我的广播接收器
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.v("HAHA BANGET","masuk ke broadcastReceiver");
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GcmIntentService.class.getName());
// Start the service, keeping the device awake while it is launching. …Run Code Online (Sandbox Code Playgroud)