How to detect if App has gone in or out of App Standyby Mode ( Android M+)

1.2k Views Asked by At

If the device is in DOZE IDLE or IDLE_MAINTENANCE mode, these events can be received if we register a broadcast receiver for "android.os.action.DEVICE_IDLE_MODE_CHANGED". But this receiver is not working when making App to go into App Standby 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?

adb commands used to make App go into App Standby

adb shell dumpsys battery unplug
adb shell am set-inactive {Package name} true

and to exit

adb shell am set-inactive {Package name} false
0

There are 0 best solutions below