Reputation: 21531
I want to know is there any option to catch the exception in application level to stop showing Unfortunately, (App Name) has stopped.
instead I want to show my custom message to the user when it crashes.
Ex: If the app crashes in any of the screen in the app I need to capture that like Crashlytics and want to show my custom message. How to do it?
Upvotes: 1
Views: 100
Reputation: 834
I personnally do it like this :
Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
//DO YOUR JOB HERE
}
});
Put this in your oncreate of activity or application. The best is to save this on your application server, and advertise your user something happenned.
Upvotes: 1