File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
app/src/main/java/moe/yuuta/mipushtester Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11package moe .yuuta .mipushtester ;
22
33import android .app .Application ;
4+ import android .os .SystemClock ;
45
56import com .crashlytics .android .Crashlytics ;
67import com .crashlytics .android .answers .Answers ;
@@ -36,6 +37,13 @@ public void onCreate() {
3637 if (!BuildConfig .DEBUG && !BuildConfig .FABRIC_KEY .equals ("disabled" )) {
3738 Fabric .with (this , new Crashlytics (), new Answers ());
3839 }
40+ Thread .UncaughtExceptionHandler currentHandler = Thread .getDefaultUncaughtExceptionHandler ();
41+ Thread .setDefaultUncaughtExceptionHandler ((t , e ) -> {
42+ com .elvishew .xlog .Logger logger = XLog .tag ("Crash" ).build ();
43+ logger .e ("App crashed" , e );
44+ SystemClock .sleep (100 );
45+ if (currentHandler != null ) currentHandler .uncaughtException (t , e );
46+ });
3947
4048 LoggerInterface newLogger = new LoggerInterface () {
4149 private com .elvishew .xlog .Logger logger =
You can’t perform that action at this time.
0 commit comments