Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCM IllegalStateException crash in onTokenRefresh, Android 8 only #165

Closed
Mitnainartinarian opened this issue May 26, 2018 · 7 comments
Closed

Comments

@Mitnainartinarian
Copy link

I'm getting a lot of crash reports with Firebase Cloud Messaging related to onTokenRefresh. So far it has only occurred on Android 8.0/8.1 devices, on many different Android devices. I don't have an Android 8 test device, but I tried it in an Android 8 emulator and couldn't reproduce the crash. Here's one of the crash reports on the Google Play dashboard:

Samsung Galaxy Note8 (greatqlte), 6144MB RAM, Android 8.0
Report 2

java.lang.IllegalStateException: 
  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 com.google.firebase.messaging.cpp.FcmInstanceIDListenerService.onTokenRefresh (FcmInstanceIDListenerService.java:24)
  at com.google.firebase.iid.FirebaseInstanceIdService.handleIntent (Unknown Source:12)
  at com.google.firebase.iid.zzg.run (Unknown Source:26)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636)
  at java.lang.Thread.run (Thread.java:764)

@takaaptech
Copy link

takaaptech commented Jun 1, 2018

Our crash rate go to 4% because of that error

capture png

@stewartmiles
Copy link
Contributor

I took a look into this issue and it looks like we're firing an Intent from FcmInstanceIDListenerService an Intent service to get the Intent service to get the most recent IID token and queue it for forwarding to the application. This does not work in Android 8.x (https://developer.android.com/about/versions/oreo/background) as the background service FcmInstanceIDListenerService can't start other services while the application is in the background. We have lined up a patch that should resolve this by moving the token refresh logic from the Intent service to FcmInstanceIDListenerService.

The problem is pretty hard to reproduce as far as I can tell since it will only happen if the IID token changes while the app is in the background or closed.

@stewartmiles
Copy link
Contributor

We have a fix checked in and it should land in a release next week.

@f84games
Copy link

is this fixed in 5.0.0?

@stewartmiles
Copy link
Contributor

The 5.1.0 release of the Firebase Unity SDK resolves this issue:
Release notes: https://firebase.google.com/support/release-notes/unity#5.1.0
Download: https://firebase.google.com/docs/unity/setup

@yantian001
Copy link

Hi ,this issue also happened on firebase unitysdk 5.4.0

@khambadkone
Copy link

We see the same error in Unitysdk 5.4.3. Does 5.5.0 have a fix, or should we downgrade to 5.3?

@firebase firebase locked and limited conversation to collaborators Oct 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants