Hacker News new | ask | show | jobs
by mflare 2496 days ago
Yes, this Doze whitelist has existed since Marshmallow, when Doze was introduced. However, adding your app to this list does not affect the limitations of background services implemented with Oreo.

If you want to implement your own push notifications, you need some kind of persistent connection to your server. Before Oreo, this was simply possible with a background service.

But starting from Oreo, your background services are shut down after 2 or 3 minutes, as soon as the corresponding app is no longer in the foreground. Of course, you could try to use a foreground service (which must display a notification). But even then the user gets a constant warning displayed like "App xyz is running in the background" or "App xyz is using battery".

Many users are not developers. If they get such a warning, they think something is wrong with your app. This is just not a good user experience. You are virtually forced to use FCM. And that doesn't work without a Google account.

1 comments

Background Services have always been killed on short notice. AFAIK, the OS regularly restarts them, even if it is completely idle with zero memory pressure. It used to be that way in KitKat and prior versions too. Using a Foreground Service have always been a hard requirement for persistent network connection — unless you were ok with reestablishing the connection every hour.

"App xyz is running in the background" or "App xyz is using battery" aren't normally shown when you foreground Notification is properly constructed. If you correctly set icon, text, notification channel and other properties, the notification bar should have only your notification and nothing else. At least it have always worked that way on devices I own.