Reputation: 101
Working with Android 8.1 and above versions, I see that a notification is always displayed on the screen without being able to clear it. Just wanted to see if there is a way to run the service without displaying any notification?
http://android-devhelp.blogspot.com/2015/12/making-service-run-in-foreground.html says we can do it but sure how reliable this is.
Looking for any suggestion.
Upvotes: 0
Views: 2770
Reputation: 15775
No, you cannot run a foreground service without a persistent notification. This is both for power purposes and clarity for the user. The blog you reference is dated December 2015, which was shortly after Marshmallow (Android 6) was launched. The rules have gotten much more strict.
Depending on what you need to do in the background, you could use JobScheduler
or the new WorkManager
. Good luck!
Upvotes: 2