我正在使用 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 中有更多的行,例如:releasewakelock Thanks