I am trying to make a heads up notification through the code below and want it to to be persistent until the user decide to dismiss it. But it is getting dismissed automatically after few second (around 10 sec). Is there any way to make it persistent and leave it to the user to dismiss it.
NotificationCompat.Builder builder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Notification")
.setContentText("Hello !!!")
.setDefaults(Notification.DEFAULT_ALL)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.addAction(R.drawable.ic_launcher,
"View Call", null)
.addAction(R.drawable.ic_launcher,
"Call Back", null);
// Gets an instance of the NotificationManager service
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, builder.build());