Is there a way to prevent the Android app from closing when an exception is thrown. I know I can use try/catch block for specific operation like network request ect. But is there a way to prevent the app from closing no matter where the exception happens and display a message to the user instead. And in the same time catch(send) the error to Firebase-Crashlytics, so you can see the statistics from there instead of Android closing the whole app and frustrating the user. For example if user click a button and exception is thrown, the proper app behavior should be to do nothing or show the error code message. I am aware that we as programmer should Unit/UI tests and try our best to eliminate all bugs, but just because clicking one button throws exception it doesn't mean the whole app is unusable.
Asked
Active
Viewed 24 times
0
a_local_nobody
- 7,360
- 5
- 25
- 45
slaviboy
- 851
- 6
- 16
-
perhaps relevant https://stackoverflow.com/questions/19897628/need-to-handle-uncaught-exception-and-send-log-file, although i don't know if this will work with crashlytics, perhaps you could log yourself – a_local_nobody Feb 16 '22 at 08:28