How to startForeground() without showing notification?

As a security feature of the Android platform, you cannot, under any circumstance, have a foregrounded service without also having a notification. This is because a foregrounded service consumes a heavier amount of resources and is subject to different scheduling constraints (i.e., it doesn’t get killed as quickly) than background services, and the user needs to know what’s possibly eating their battery. So, don’t do this.

However, it is possible to have a “fake” notification, i.e., you can make a transparent notification icon (iirc). This is extremely disingenuous to your users, and you have no reason to do it, other than killing their battery and thus creating malware.

Leave a Comment