Regular notification will not show the X button close in android

I created a notification using the android.support.v4.app.NotificationCompat.Builder file. The notification displayed in the notification area is excellent. But on Android 4.2, the default close button is not displayed.

http://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#setOngoing(boolean)

According to the document, its the type of regular notification that the close button X should show, but it is not. Using the following code:

mBuilder = new NotificationCompat.Builder(context); mBuilder.setSmallIcon(iconId); mBuilder.setContentTitle(titleText); mBuilder.setContentText(moreinfoText); mBuilder.setOngoing(false); //to make it regular PendingIntent pintent = PendingIntent.getActivity(context,noteId,resultIntent,PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(pintent); NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(noteId, mBuilder.build()); 

Search on Google, but did not find anything like it. Please suggest.

Thank you for your time!

+7
source share

All Articles