Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_freeworld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_freeworld
Commits
f6e839cc
Commit
f6e839cc
authored
Aug 06, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置检测app崩溃工具类配置完成
parent
8d03c471
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
BaseModuleInit.java
..._base/src/main/java/com/fry/base/base/BaseModuleInit.java
+28
-0
No files found.
library_base/src/main/java/com/fry/base/base/BaseModuleInit.java
View file @
f6e839cc
...
@@ -3,9 +3,11 @@ package com.fry.base.base;
...
@@ -3,9 +3,11 @@ package com.fry.base.base;
import
android.app.Application
;
import
android.app.Application
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
me.goldze.mvvmhabit.crash.CaocConfig
;
import
me.goldze.mvvmhabit.utils.KLog
;
import
me.goldze.mvvmhabit.utils.KLog
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
import
me.goldze.mvvmhabit.utils.ToastUtils
;
import
com.fry.base.BuildConfig
;
import
com.fry.base.BuildConfig
;
import
com.fry.base.R
;
import
com.fry.base.global.Constants
;
import
com.fry.base.global.Constants
;
import
com.tencent.bugly.Bugly
;
import
com.tencent.bugly.Bugly
;
import
com.tencent.bugly.crashreport.CrashReport
;
import
com.tencent.bugly.crashreport.CrashReport
;
...
@@ -31,6 +33,32 @@ public class BaseModuleInit implements IModuleInit<Void> {
...
@@ -31,6 +33,32 @@ public class BaseModuleInit implements IModuleInit<Void> {
// ARouter.init(application);
// ARouter.init(application);
ToastUtils
.
setGravity
(
Gravity
.
CENTER
,
0
,
0
);
ToastUtils
.
setGravity
(
Gravity
.
CENTER
,
0
,
0
);
if
(
isMainProcess
)
{
//配置全局异常崩溃操作
CaocConfig
.
Builder
.
create
()
//背景模式,开启沉浸式
.
backgroundMode
(
CaocConfig
.
BACKGROUND_MODE_SHOW_CUSTOM
)
//是否启动全局异常捕获
.
enabled
(
BuildConfig
.
DEBUG
)
//是否显示错误详细信息
.
showErrorDetails
(
true
)
//是否显示重启按钮
.
showRestartButton
(
true
)
//是否跟踪Activity
.
trackActivities
(
true
)
//崩溃的间隔时间(毫秒)
.
minTimeBetweenCrashesMs
(
2000
)
//错误图标
.
errorDrawable
(
R
.
mipmap
.
ic_launcher_main
)
//重新启动后的activity
//.restartActivity(SplashActivity.class)
//.errorActivity(YourCustomErrorActivity.class) //崩溃后的错误activity
//.eventListener(new YourCustomEventListener()) //崩溃后的错误监听
.
apply
();
// 在主进程初始化调用哈
// BlockCanary.install(application, new AppBlockCanaryContext()).start();
}
return
false
;
return
false
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment