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"); } }