仅在版本> = 26上收到通知的应用程序崩溃。 我使用扩展 GcmListenerService 的类。
这是我收到通知时的日志猫:
java.lang.RuntimeException: Unable to start receiver com.google.android.gms.gcm.GcmReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=it.polymedia.adr_prod cmp=it.polymedia.adr_prod/com.hpe.adr.presentation.notifications.gcm.GCMPushReceiverService (has extras) }: app is in background uid UidRecord{280eacd u0a283 RCVR bg:+2m2s87ms idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3397)
at android.app.ActivityThread.-wrap18(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=it.polymedia.adr_prod cmp=it.polymedia.adr_prod/com.hpe.adr.presentation.notifications.gcm.GCMPushReceiverService (has extras) }: app is in background uid UidRecord{280eacd u0a283 RCVR bg:+2m2s87ms idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1538)
at android.app.ContextImpl.startService(ContextImpl.java:1484)
at android.content.ContextWrapper.startService(ContextWrapper.java:663)
at android.content.ContextWrapper.startService(ContextWrapper.java:663)
at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:91)
at com.google.android.gms.gcm.GcmReceiver.doStartService(Unknown Source:23)
at com.google.android.gms.gcm.GcmReceiver.zze(Unknown Source:0)
at com.google.android.gms.gcm.GcmReceiver.onReceive(Unknown Source:106)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3390)
at android.app.ActivityThread.-wrap18(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
01-03 15:18:45.206 13281-13281/? E/Zygote: isWhitelistProcess - Process is Whitelisted
这是我的礼物
compileSdkVersion 26
buildToolsVersion '26.0.3'
defaultConfig {
applicationId "it.polymedia.adr"
minSdkVersion 19
targetSdkVersion 26
versionCode 40300020
versionName "4.3.2"
multiDexEnabled true}
...
compile 'com.google.android.gms:play-services-gcm:9.6.1'
在切换到Firebase之前是否有解决方法?