In my app i have notification with pause/play action, however, when user clicks on the action, notification bar is closing. How can i prevent notification bar from closing upon action click?
Method which creates notifcation:
public void createNotification() {
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent, 0);
Intent intent2 = new Intent(this, IntentActivity.class);
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
pIntent2 = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent2, 0);
builder = new NotificationCompat.Builder(context);
Notification noti = builder
.setAutoCancel(true)
.setContentTitle("Title")
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pIntent)
.setPriority(Notification.PRIORITY_MAX)
.setStyle(new NotificationCompat.BigTextStyle().bigText("Czas trwania: " + time + "\nKalorie: 4kcal"))
.addAction(icon, actionString, pIntent2).build();
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);
}