Notification Clicks in Custom View

68 Views Asked by At

enter link description hereI create a custom layout for notification in android.I use remoteview for building notification and also add setOnClickPendingIntent() in some widgets of custom layout.But when user click on it the process in running but the notification setAutoCancel(true) not working.I attach some pics of my code.If anyone face this issue and resolve so you can help me.enter image description here

video link

1

There are 1 best solutions below

8
snachmsm On

you are calling startForeground, so you are running some Service and this Notification is it's graphic representation on the screen. setting setAutoCancel(true) won't work for such notification, as it will live as long as Service is. You have to stop this service by calling stopForeground(true) (e.g. in onDestroy), then your sticked-to-service notification will disappear