Skip to content

Commit

Permalink
调整代码
Browse files Browse the repository at this point in the history
  • Loading branch information
xuexiangjys committed Sep 5, 2019
1 parent 5b0e69a commit b08f898
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -35,13 +35,13 @@ protected void onCreate(Bundle savedInstanceState) {
if (!NotificationUtils.isNotifyPermissionOpen(this)) {
new AlertDialog.Builder(this)
.setCancelable(false)
.setTitle("通知栏权限")
.setMessage("请打开应用的通知权限,否则应用将无法收到通知!")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
.setMessage("通知权限未打开,是否前去打开?")
.setPositiveButton("是", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface d, int w) {
NotificationUtils.openNotifyPermissionSetting(MainActivity.this);
}
})
.setNegativeButton("否", null)
.show();
}
}
Expand Down
Expand Up @@ -197,6 +197,7 @@ public static void openNotifyPermissionSetting(Context context) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
intent.putExtra(Settings.EXTRA_CHANNEL_ID, context.getApplicationInfo().uid);
context.startActivity(intent);
return;
}
Expand Down

0 comments on commit b08f898

Please sign in to comment.