1

H, I miss a lot the old time when users could comment on crashes in Android. Now I realise that the best way to reproduce something like this would be if the app could detect when it was open for the first time right after a Fatal error, so I/the app can advise the user to send a personalised comment on how the crash happened.

Is there a way, using Firebase/Crashlytics, to know that the app crashed previously, when opening an app?

Myoch
  • 793
  • 1
  • 6
  • 24

2 Answers2

1

If there is an uncaught exception in an activity (or service) the activity is forcably closed and the previos activity of the app is shown. If the last Activity causes the crash the app is closed.

What you can do to detect this situation is to register a global-uncaught-exception-handler that writes `firebaseException=true" to a file/app-settings if the exception comes from firebase before calling the previous global-uncaught-exception-handler.

In every Activity-s onCreate you can load firebaseException and act according (do not forget to write firebaseException=false after.

I have never worked with Crashlytics but i assume that it also hooks into uncaught-exception-handler so it is important that Crashlytics is initialized before you set your own handler and that your handler calls the previous uncaught-exception-handler when done

k3b
  • 14,517
  • 7
  • 53
  • 85
0

You may use custom Crashlytics webhooks to notify your service about crashes and reach back next time is opened.

sashimi
  • 1,224
  • 2
  • 15
  • 23