2
I have an application where I receive daily notifications, however by clicking on this notification, it still stays on my bar status. I’m using the class Notificationcompat for the creation of these notifications, in which whenever another one is launched, it overrides the previous one. Below follows the code that generates the notification:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(R.mipmap.ic_launcher);
Intent intent = new Intent(context, MyActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(
context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
builder.setLargeIcon(BitmapFactory.decodeResource(
context.getResources(), R.mipmap.ic_launcher));
builder.setContentTitle("Title");
builder.setContentText("Content of notification");
NotificationManager notificationManager = (NotificationManager) context.
getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(1, builder.build());
How do I make sure that when I click on the notification it no longer stays on the status?
But what would be the difference between setAutoCancel and FLAG_AUTO_CANCEL?
– viana
I already put the +1 because I had already solved here with the first option hours ago. Now I do not understand why they denied the question.
– viana
To negative there are several! To answer few! Hahahaha
– Thiago Luiz Domacoski