Re: [問題] GCM離線接收訊息,當掉
小弟在此附上我的程式碼:
https://gist.github.com/anonymous/3156a03c53f8aed5fdb6
V/GCMBaseIntentService(4691): Releasing wakelock
W/dalvikvm(4691): threadid=11: thread exiting with uncaught exception (group=0x40a3a1f8)
E/AndroidRuntime(4691): FATAL EXCEPTION: IntentService[GCMIntentService-764872454773-1]
E/AndroidRuntime(4691): java.lang.NullPointerException
E/AndroidRuntime(4691): at com.booya.vague.utils.NotificationMsg.emitMessage(NotificationMsg.java:29)
E/AndroidRuntime(4691): at com.booya.vague.GCMIntentService._processSayHi(GCMIntentService.java:104)
E/AndroidRuntime(4691): at com.booya.vague.GCMIntentService.onMessage(GCMIntentService.java:45)
E/AndroidRuntime(4691): at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:223)
E/AndroidRuntime(4691): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
E/AndroidRuntime(4691): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(4691): at android.os.Looper.loop(Looper.java:137)
原因我大概知道,因為我目前的用法是在app一啓動,就利用當下的Activity產生的
Notification Service註冊給NotificationMsg這個Singleton的_barManager,
所以在app執行的過程中接收訊息顯示在_barManager上面都沒問題,但一但從背景移除
這應用程式,就會發生_barManager為null的情況,請問各位高手是怎麼應對這種狀況?
※ 引述《GhostMonkey (瘋狂上班族~~)》之銘言:
: 大家好,我是Android開發者新手
: 我目前GCM處理狀況都正常,只有在將它從背景移除後,若有訊息經由notification
: 傳送過來,就會造成app停止回應的狀況,請問這種情況要怎麼能夠成功接收此
: notification呢? 謝謝大家。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.168.84.120
推
02/14 04:14, , 1F
02/14 04:14, 1F
→
02/16 00:51, , 2F
02/16 00:51, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):