androidandroid-notificationsandroid-8.0-oreonotification-channel

Intent to open the Notification Channel settings from my app


What's the Intent that I need to send in order to open the settings of a Notification Channel that I've previously created in my app? I need to link to it from my app.


Solution

  • To open the notification settings for a single channel, use ACTION_CHANNEL_NOTIFICATION_SETTINGS:

    Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
        .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName())
        .putExtra(Settings.EXTRA_CHANNEL_ID, yourChannelId);
    startActivity(intent);
    

    To open the notification settings for the app in general (i.e. to see all channels), use ACTION_APP_NOTIFICATION_SETTINGS:

    Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
        .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
    startActivity(intent);