diff --git a/android/src/main/java/io/invertase/firebase/Utils.java b/android/src/main/java/io/invertase/firebase/Utils.java index 78373bb2..f71eebcc 100644 --- a/android/src/main/java/io/invertase/firebase/Utils.java +++ b/android/src/main/java/io/invertase/firebase/Utils.java @@ -152,7 +152,15 @@ public class Utils { appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND && appProcess.processName.equals(packageName) ) { - ReactContext reactContext = (ReactContext) context; + ReactContext reactContext; + + try { + reactContext = (ReactContext) context; + } catch(ClassCastException exception) { + // Not react context so default to true + return true; + } + return reactContext.getLifecycleState() == LifecycleState.RESUMED; } } diff --git a/tests/android/app/build.gradle b/tests/android/app/build.gradle index 54ba3693..526708c4 100755 --- a/tests/android/app/build.gradle +++ b/tests/android/app/build.gradle @@ -122,7 +122,7 @@ dependencies { // Cloud Firestore implementation "com.google.firebase:firebase-firestore:17.1.0" // Cloud Messaging / FCM - implementation "com.google.firebase:firebase-messaging:17.3.3" + implementation "com.google.firebase:firebase-messaging:17.3.2" // Crashlytics implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') { transitive = true