项目介绍:
AppManager
An elegant exit application and restart mechanism management.
⊙开源不易,希望给个star或者fork奖励
⊙拥抱开源:https://github.com/nanchen2251/
⊙交流群(拒绝无脑问):118116509
特点
-
支持优雅的退出应用
-
支持崩溃后重启
-
支持不弹出崩溃对话框
使用方法
1、添加依赖
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.nanchen2251:AppManager:1.0.1'
}
2、在需要使用的地方使用(我们建议在 Application 中,并且继承库的 CrashApplication )
// 设置崩溃后自动重启 APP
// 参数依次为 上下文(建议是Application),是否是debug模式,是否崩溃后重启,重启延迟时间,重启的Activity
UncaughtExceptionHandlerImpl.getInstance().init(this, BuildConfig.DEBUG, true, 0, MainActivity.class);
3、你也可以禁止重启
// 禁止重启
UncaughtExceptionHandlerImpl.getInstance().init(this,BuildConfig.DEBUG);