Android 6.0 comes with a brand new feature called Doze that preserves battery life. It turns On by itself and you can neither opt-in nor opt-out of it. If Android thinks your battery charge needs saving, it will step-in and take measures to preserve it. One of the things Doze does to preserve the battery is to stop background notifications. You will continue to get background notifications from Hangouts but most if not all apps will not make the cut. If you have a different app that you want to rely on for important messages, or just have a few you would like to exclude from the Doze feature, you will have to explicitly tell Android 6.0 to leave it alone when it turns Doze On. Here’s how.
Open the Settings app and go to the Battery preference. Tap the more button on the action bar at the top right, and select ‘Battery optimization’ from the menu.
On the Battery optimization screen, switch to the All apps list from the drop-down to view all apps on your device. Tap an app and from the menu, set it to ‘Don’t optimize’ to exclude it from the Doze feature.
Needless to say, if you exclude too many apps from Doze, the feature itself will not be much use to you so choose carefully. The apps you chose to exclude from Doze will appear in the Not Optimized list. Google Play Services is the one system service that is excluded from Doze automatically and because it handles essential services on Android, you cannot include optimize it.