How to detect if App has gone in or out of App Standyby Mode ( Android M+) : <p>If the device is in DOZE IDLE or IDLE_MAINTENANCE mode, these events can be received if we register a broadcast receiver for "<strong>android.os.action.DEVICE_IDLE_MODE_CHANGED</strong>". But this receiver is not working when making App to go into <strong>App Standby</strong> using adb commands. Is is possible that we can programmatically check whether the app has gone in or exited from the App Standby mode for devices running on Marshmallow and above?</p>

<p>adb commands used to make App go into App Standby</p>

<pre><code>adb shell dumpsys battery unplug
adb shell am set-inactive {Package name} true
</code></pre>

<p>and to exit</p>

<pre><code>adb shell am set-inactive {Package name} false
</code></pre>
