8

My app integrates FCM to receive push notifications and it works okay. However, I am facing issue that on installation it crashes randomly. It is very random and occurring on OS 6.0+ devices till latest but randomly occurs.

Code wise, in service class only show notification code is written and added service in manifest.

I am getting below exception on app loads

Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.google.firebase.iid.FirebaseInstanceIdInternalReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.firebase.INSTANCE_ID_EVENT pkg=com.xx.xx cmp=com.xx.xx/com.google.firebase.iid.FirebaseInstanceIdService (has extras) }: app is in background uid UidRecord{997e286 u0a92 RCVR idle procs:1 seq(0,0,0)}
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3259)
       at android.app.ActivityThread.-wrap17(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6540)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.firebase.INSTANCE_ID_EVENT pkg=com.xx.xx cmp=com.xx.xx/com.google.firebase.iid.FirebaseInstanceIdService (has extras) }: app is in background uid UidRecord{997e286 u0a92 RCVR idle procs:1 seq(0,0,0)}
       at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1497)
       at android.app.ContextImpl.startService(ContextImpl.java:1453)
       at android.content.ContextWrapper.startService(ContextWrapper.java:644)
       at android.content.ContextWrapper.startService(ContextWrapper.java:644)
       at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:91)
       at com.google.firebase.iid.FirebaseInstanceIdInternalReceiver.zzh(Unknown Source:12)
       at com.google.firebase.iid.FirebaseInstanceIdInternalReceiver.zzb(Unknown Source:76)
       at com.google.firebase.iid.FirebaseInstanceIdInternalReceiver.onReceive(Unknown Source:28)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3252)
       at android.app.ActivityThread.-wrap17(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6540)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
VVB
  • 7,363
  • 7
  • 49
  • 83
  • What version of the Firebase libraries are you building with? – Bob Snyder Sep 21 '17 at 15:24
  • I think you need 10.2.1 or later. – Bob Snyder Sep 21 '17 at 15:44
  • Ok let me try. Thank you for response – VVB Sep 21 '17 at 15:46
  • Did they fix anything in this library version also, one more thing is don I need to upgrade play services libs as well? – VVB Sep 22 '17 at 04:50
  • 1
    10.2.1 is the first version that supports FCM with Android O. Some of the changes might apply to your problems. See the [release notes](https://firebase.google.com/support/release-notes/android). In answer to your second question: All Firebase and Play Services libs must be the same version. – Bob Snyder Sep 22 '17 at 05:07
  • Ok Thanks. Give me a try – VVB Sep 22 '17 at 05:08

1 Answers1

5

Use this library version for firebase

compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
Jitendra
  • 3,608
  • 2
  • 17
  • 19