On Pixel and Nexus devices you have the lowest chance of something going wrong with background processing, but still there are several places to look at!
- Some use-cases are no longer possible or paradoxically more battery consuming (e.g. gathering sensor data through sensor batching, see Solution for developers) with the introduction of Doze mode in Android 6+ and you may need to opt the app out of battery optimizations to make it work properly.
- A serious Doze mode bug existed in Android 6.0 that prevented foreground services from doing their intended job (see Solution for devs for workaround), but luckily this was later fixed in 7.0.
- After Android 8, users or even the system (Adaptive battery in Android 9) can decide to prevent your app’s background processes from working and you may need to check the Background restrictions (or limits) option in your phone settings.
Solution for users
There’s a special option in Settings > Apps > Your app > Advanced > Battery > Background restrictions. If users accidentally enable this option, it will break their apps. And users do enable that option!
Pie y pre-Pie
If you see background processing issues, overall it is a good idea to make your app not battery optimized to ensure it gets the freedom it needs to perform in the background.
- Go to Settings > Apps > Your app > Advanced > Battery > Battery optimization
- Change view to All apps
- Search for your app
- Choose Not optimized
Make sure Settings > Apps > Your app > Advanced > Battery > Background limitations is not enabled. If the app is not yet optimized for Oreo API level it will break their background processing.
If all fails
If all fails, you can turn doze mode completely off in Settings > Developer options. (If you don’t know how to enable developer options, a web search-engine should help).