0

I want my react-native app to show a Firebase In-App Message on the first app launch after crash. Seems this is impossible at the moment? I'm using Firebase Crashlytics to track crashes.

stkvtflw
  • 12,092
  • 26
  • 78
  • 155

1 Answers1

0

I'm not 100% on the Firebase Messaging portion of it, but in terms of Crashlytics, you should be able to programmatically detect when there's been a crash and act if that condition is true (reference).

First, you could disable the default automatic crash collection:

<meta-data
    android:name="firebase_crashlytics_collection_enabled"
    android:value="false" />

Then, you could do something like this to detect if a crash happened:

FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
...
if (crashlytics.didCrashOnPreviousExecution()) {
    //send an in-app message: https://firebase.google.com/docs/in-app-messaging/explore-use-cases
}

if (crashlytics.checkForUnsentReports()) {
    //will guarantee any unsent crash reports will be sent once this code block executes
    crashlytics.sendUnsentReports();
}
Kevin Kokomani
  • 1,568
  • 7
  • 14