GCM收购唤醒锁

时间:2013-04-29 15:14:53

标签: android manifest google-cloud-messaging wakelock

我使用GCM发送通知,一切正常。我尝试创建一个GCM库,因此我可以轻松地将GCM集成到我未来的Android应用程序中。我创建了一个项目,其中包含显示通知所需的所有内容,并将其标记为库。当我执行应用程序时,它获取注册ID,一切似乎都有效,但没有显示通知。

使用Tag:GCM中的过滤器LogCat,我得到以下信息:

04-29 15:24:33.937: V/GCMBroadcastReceiver(19334): onReceive: com.google.android.c2dm.intent.REGISTRATION
04-29 15:24:33.937: V/GCMBroadcastReceiver(19334): GCM IntentService class: com.mobiblanc.slice.GCMIntentService
04-29 15:24:33.937: V/GCMBaseIntentService(19334): Acquiring wakelock
04-29 15:24:44.195: V/GCMBroadcastReceiver(19334): onReceive: com.google.android.c2dm.intent.RECEIVE
04-29 15:24:44.195: V/GCMBroadcastReceiver(19334): GCM IntentService class: com.mobiblanc.slice.GCMIntentService
04-29 15:24:44.195: V/GCMBaseIntentService(19334): Acquiring wakelock
04-29 15:24:44.242: V/GCMBroadcastReceiver(19334): onReceive: com.google.android.c2dm.intent.RECEIVE
04-29 15:24:44.242: V/GCMBroadcastReceiver(19334): GCM IntentService class: com.mobiblanc.slice.GCMIntentService
04-29 15:24:44.242: V/GCMBaseIntentService(19334): Acquiring wakelock
04-29 15:24:44.320: V/GCMBroadcastReceiver(19334): onReceive: com.google.android.c2dm.intent.RECEIVE
04-29 15:24:44.320: V/GCMBroadcastReceiver(19334): GCM IntentService class: com.mobiblanc.slice.GCMIntentService
04-29 15:24:44.320: V/GCMBaseIntentService(19334): Acquiring wakelock
04-29 15:24:44.398: V/GCMBroadcastReceiver(19334): onReceive: com.google.android.c2dm.intent.RECEIVE
04-29 15:24:44.398: V/GCMBroadcastReceiver(19334): GCM IntentService class: com.mobiblanc.slice.GCMIntentService
04-29 15:24:44.398: V/GCMBaseIntentService(19334): Acquiring wakelock
04-29 15:24:44.453: V/GCMBroadcastReceiver(19334): onReceive: com.google.android.c2dm.intent.RECEIVE
04-29 15:24:44.460: V/GCMBroadcastReceiver(19334): GCM IntentService class: com.mobiblanc.slice.GCMIntentService
04-29 15:24:44.460: V/GCMBaseIntentService(19334): Acquiring wakelock

PS:当我以简单的方式使用GCM时,我在Logcat中有更多行:释放wakelock 感谢

1 个答案:

答案 0 :(得分:0)

奇怪,但给出here的解决方案对我有用。仔细检查清单文件并验证广播接收器/目标服务标签和实际服务类名称是否匹配。最后尝试将GCM intent服务类及其父活动放在同一个包中。