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.
Add a comment |
1 Answer
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
8 Comments
Muhammad Asad
but i need to use foreground service for represent the notification.I also stop the service when application terminate
snachmsm
so you can't dismiss this
Notification. if you want a Notification, which will disappear after click - it can't be same, which is representing Service, so you have show another (using notificationManager.notify(ANOTHER_ID, notification)) or at least modify look of this Service-related oneMuhammad Asad
i remove a notification using notificationManager.cancel(1).notification remove and i also stop the service but the notification panel does not dismiss
Muhammad Asad
i attach a video in the question
Muhammad Asad
i edit my question you can see
|