2013-04-29 64 views
0

我使用GCM發送通知,一切工作正常。我試圖創建一個GCM庫,所以我可以很容易地將GCM整合到我未來的android應用程序中。我創建了一個項目,其中包含我需要顯示通知的所有內容,並將其標記爲庫。當我執行應用程序時,它會得到註冊ID,並且一切似乎都正常,但不會顯示通知。GCM獲取喚醒鎖

使用過濾器Tag:GCMLogCat我得到如下:

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中更多的線,如:釋放激活鎖定 感謝

回答

0

奇怪但給出的解決方案here爲我工作。仔細檢查清單文件並驗證廣播接收者/意圖服務標籤和實際服務類名稱是否匹配。最後,嘗試將GCM intent服務類及其父活動放在同一個包中。