Android 6 and 7 have some power optimizations (doze mode) which restrict app networking when device is not used.
User may disable optimization mode for any app in Battery settings:
Is it possible to check if optimization is enabled for my app or not? I need to ask user to disable optimization for better app functionality, but I don't know how to check it programatically.
This one was a bit tricky to track down: here's what you are looking for