fix: 增加添加到白名单功能

This commit is contained in:
xiaoyan 2023-11-10 10:48:03 +08:00
parent 7a83b510e9
commit 89b6c8e01d
4 changed files with 10 additions and 2 deletions

View File

@ -230,4 +230,6 @@ dependencies {
implementation 'com.tencent.jg:jg:1.1'
//
implementation 'com.github.xuexiangjys.XPush:keeplive:1.0.0'
// Android应用白名单添加 https://github.com/WaseemSabir/BatteryPermissionHelper
implementation 'com.waseemsabir:betterypermissionhelper:1.0.3'
}

View File

@ -52,6 +52,7 @@ import com.teprinciple.mailsender.Mail;
import com.teprinciple.mailsender.MailSender;
import com.umeng.message.UmengNotificationClickHandler;
import com.umeng.message.entity.UMessage;
import com.waseemsabir.betterypermissionhelper.BatteryPermissionHelper;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -114,6 +115,11 @@ public class HomeActivity extends BaseActivity {
getLifecycle().addObserver(LocationLifeCycle.getInstance());
// 初始化图像识别组件
OCRManager.Companion.getInstance().init(HomeActivity.this);
// 开始申请后台运行的权限
boolean isOpenBatteryPermission = BatteryPermissionHelper.Companion.getInstance().isBatterySaverPermissionAvailable(HomeActivity.this, true);
if (!isOpenBatteryPermission) {
BatteryPermissionHelper.Companion.getInstance().getPermission(HomeActivity.this, true, true);
}
} else {
finish();
}

View File

@ -23,7 +23,7 @@ public class KeepLiveUtils {
@Override
public void onNotificationClick(Context context, Intent intent) {
//可以做一些唤醒程序的操作这里只是简单地启动了应用
AppUtils.launchApp(application.getPackageName());
// AppUtils.launchApp(application.getPackageName());
}
})
//要想不显示通知可以设置为false默认是false

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.anko_version = '0.10.1'//
ext.kotlin_version = '1.5.10'
ext.kotlin_version = '1.7.10'
repositories {
mavenCentral()
// bug