Reputation: 1135
In my app i have a Service that runs all the time in the background because i have a socket that i need to listen too all the time. The idea is i have a notification that is NO_CLEAR notification it means that this notification cannot be cleared by swiping left or right and am starting this notification from the Service.
On Android 5.0 this is fine but on Android 6.0 user can swipe the notification left or right and they will ask him if he want to remove it and if he press remove the notification will go and than the Service will be in danger to be stopped
Any idea what can i do so that i can guarantee that the Service wont stop and Notification wont go?
Upvotes: 1
Views: 661
Reputation: 426
Create notification with flag n.flags |= Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT; Please use reference http://www.laurivan.com/android-make-your-notification-sticky/
Upvotes: 2