I've written the following method to send notificaitons, notifications are working however when the notification action button settings
is pressed, the pending intent to the channel settings isn't opened. Any ideas why this isn't working?
private static final String NOTIFICATION_GROUP_ID = "notification_group";
private static final int NOTIFICATION_ID = 546893;
private static final String NOTIFICATION_CHANNEL_ID = "notification_channel";
public static void sendNotification(Context context, int iconId, String title, String message, String channelId, int notificationId)
{
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
NotificationChannel notificationChannel = new NotificationChannel(
channelId, title, NotificationManager.IMPORTANCE_HIGH);
notificationManager.createNotificationChannel(notificationChannel);
Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
intent.putExtra(Settings.EXTRA_CHANNEL_ID, NOTIFICATION_ID);
PendingIntent settingsIntent = PendingIntent.getActivity(context, 0, intent, 0);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, channelId)
.setColor(ContextCompat.getColor(context, R.color.colorPrimary))
.setSmallIcon(iconId)
.setContentTitle(title)
.setContentText(message)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setGroup(NOTIFICATION_GROUP_ID)
.addAction(iconId, "settings", settingsIntent)
.setAutoCancel(true);
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
}