From a61a41a068bc45c3ee88b73d104ca4aa363db313 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 17 Nov 2022 17:21:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A3=80=E6=B5=8B=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=9D=83=E9=99=90=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 2 +- .../phonelive/activity/LauncherActivity.java | 5 +++ .../yunbao/main/activity/MainActivity.java | 35 +++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5f2f0f850..4a9137bef 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -82,7 +82,7 @@ - + () { @Override public void callback(ConfigBean bean) { - if(bean==null){ + if (bean == null) { return; } //是否需要老用户回归弹窗 @@ -417,7 +423,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } @Override - public void onNext(kotlin.Unit unit) { + public void onNext(Unit unit) { String Uid = floatBanner.getUid(); LiveHttpUtil.getLiveInfo(Uid + "", new HttpCallback() { @Override @@ -477,6 +483,29 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //获取指导员账号 ConversationIMListManager.get(this).getUserInstructor(this); checkVersion(); + if(!SpUtil.getInstance().getBooleanValue("NOTIFICATION")){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + this.requestPermissions(new String[]{Manifest.permission.ACCESS_NOTIFICATION_POLICY,Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE}, 233); + } + DialogUitl.showSimpleDialog(this, "应用需要通知权限", new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + Intent intent = new Intent(); + intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); + intent.putExtra("app_package", getPackageName()); + intent.putExtra("app_uid", getApplicationInfo().uid); + // for Android 8 and above + intent.putExtra("android.provider.extra.APP_PACKAGE", getPackageName()); + startActivity(intent); + } + }); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + Log.i("权限","requestCode = " + requestCode + ", permissions = " + Arrays.deepToString(permissions) + ", grantResults = " + Arrays.toString(grantResults)); } @Override @@ -729,7 +758,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene bundle.putString("send_exp", obj.getString("send_exp")); bundle.putString("sign_day", obj.getString("sign_day")); fragment.setArguments(bundle); - if(!getSupportFragmentManager().isStateSaved()) { + if (!getSupportFragmentManager().isStateSaved()) { fragment.show(getSupportFragmentManager(), "SigninDialog"); } }