title: Check if battery optimization is enabled or not for an app
body: <p>Android 6 and 7 have some power optimizations (doze mode) which restrict app networking when device is not used.</p>
  
  <p>User may disable optimization mode for any app in Battery settings:</p>
  
  <p><a href="https://i.stack.imgur.com/iXk8X.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iXk8X.png" alt="android settings screenshot"></a></p>
  
  <p>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.</p>