|
@@ -2,6 +2,9 @@ package com.miekir.ocr;
|
|
|
|
|
|
|
|
import android.app.Application;
|
|
import android.app.Application;
|
|
|
|
|
|
|
|
|
|
+import com.yc.toollib.crash.CrashHandler;
|
|
|
|
|
+import com.yc.toollib.crash.CrashListener;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
@@ -15,5 +18,30 @@ public class OCRApplication extends Application {
|
|
|
super.onCreate();
|
|
super.onCreate();
|
|
|
|
|
|
|
|
//RxActivityResult.register(this);
|
|
//RxActivityResult.register(this);
|
|
|
|
|
+
|
|
|
|
|
+ CrashHandler.getInstance().init(this, new CrashListener() {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 重启app
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void againStartApp() {
|
|
|
|
|
+ //CrashToolUtils.reStartApp1(App.this,1000);
|
|
|
|
|
+ //CrashToolUtils.reStartApp2(App.this,1000, MainActivity.class);
|
|
|
|
|
+ //CrashToolUtils.reStartApp3(AppManager.getAppManager().currentActivity());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 自定义上传crash,支持开发者上传自己捕获的crash数据
|
|
|
|
|
+ * @param ex ex
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void recordException(Throwable ex) {
|
|
|
|
|
+ //崩溃文件存储路径:/storage/emulated/0/Android/data/你的包名/cache/crashLogs
|
|
|
|
|
+ //崩溃文件存储路径:/storage/emulated/0/Android/data/com.miekir.ocr/cache/crashLogs
|
|
|
|
|
+ //崩溃页面截图存储路径:/storage/emulated/0/Android/data/你的包名/cache/crashPics
|
|
|
|
|
+ //自定义上传crash,支持开发者上传自己捕获的crash数据
|
|
|
|
|
+ //StatService.recordException(getApplication(), ex);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|