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 #330

Closed
khambadkone opened this issue Mar 11, 2019 · 3 comments
Closed

FCM IllegalStateException crash in onTokenRefresh #330

khambadkone opened this issue Mar 11, 2019 · 3 comments

Comments

@khambadkone
Copy link

Please fill in the following fields:

Unity editor version: Various 2018.2.x
Firebase Unity SDK version: 5.4.3, 5.1.1
Additional SDKs you are using (Facebook, AdMob, etc.): MoPub with Facebook, IronSource.
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): Android

Please describe the issue here:

Many of our games that we have migrated from GCM (via Prime31's plugin) to Firebase report crashes. All throw the following logs 👍 java.lang.IllegalStateException:
at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1666)
at android.app.ContextImpl.startService (ContextImpl.java:1611)
at android.content.ContextWrapper.startService (ContextWrapper.java:677)
at com.google.firebase.messaging.cpp.FcmInstanceIDListenerService.onTokenRefresh (FcmInstanceIDListenerService.java:24)
at com.google.firebase.iid.FirebaseInstanceIdService.zza (Unknown Source:71)
at com.google.firebase.iid.FirebaseInstanceIdService.handleIntent (Unknown Source:158)
at com.google.firebase.iid.zzg.run (Unknown Source:26)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
at java.lang.Thread.run (Thread.java:764)

Please answer the following, if applicable:

No. However, our implementation in each of our games follows this same approach.

Additional question

Why isn't FirebaseMessagingService's onNewToken triggered, instead of the deprecated FcmInstanceIDListenerService.onTokenRefresh ?

@khambadkone khambadkone added the new New issue. label Mar 11, 2019
@stewartmiles
Copy link
Contributor

@khambadkone I think the exception you're seeing is due to the use of the Android component from the a release of the Firebase Unity SDK before 5.1.1 (see #165 for more information). The token listener service is redistributed in Assets/Firebase/Editor/m2repository/com/google/firebase/firebase-messaging-unity/VERSION which will end up being resolved into Assets/Plugins/Android/com.google.firebase.firebase-messaging-unity-VERSION.aar. If you're running an old version of this component new tokens cause the background service to attempt to launch another service will doesn't work on Android 8 and beyond. So I recommend making sure that you're running the latest revision of the Android component. If you are doing so already, it would probably be useful to share a project based upon our messaging sample that reproduces this.

Why we're using FirebaseInstanceIdService. onTokenRefresh vs. FirebaseMessagingService.onNewToken, it's primarily a syntactic change that we decided to not apply to the C SDK yet. FirebaseInstanceIdService isn't deprecated as it is still used if you just want to use FirebaseInstanceId without messaging.

@stewartmiles stewartmiles added type: question and removed new New issue. labels Mar 11, 2019
@chkuang-g
Copy link
Contributor

Hi @khambadkone
Is the issue resolved on your end?

@stewartmiles
Copy link
Contributor

@khambadkone since we haven't heard from you we'll assume that your issue is resolved with the latest SDK.

@firebase firebase locked and limited conversation to collaborators Oct 24, 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

3 participants