Is there any way I can launch an intent to get to Android\'s notification settings screen for my app (pictured below)? Or an easy way I can make a PreferenceScreen item that
I merged the code of some of the answers above and added little edit, I have tested and it working fine on Android KitKat, Lollipop, Marshmallow, Nougat, Oreo and Pie, API level 19 - 28
public void goToNotificationSettings(Context context) {
String packageName = context.getPackageName();
try {
Intent intent = new Intent();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName);
intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O) {
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra("android.provider.extra.APP_PACKAGE", packageName);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", packageName);
intent.putExtra("app_uid", context.getApplicationInfo().uid);
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setData(Uri.parse("package:" + packageName));
} else {
return;
}
startActivity(intent);
} catch (Exception e) {
// log goes here
}
}