34

I am following instructions on this android page to switch android to doz mode to test my app, I have used a real device as well as emulator. But in both cases when I give the second command once or several times, which is

adb shell dympsys deviceidle step

it only says Stepped: ACTIVE Before giving the commands I turned off/locked the device as well but no use. I wanted how my app behaves in doze mode but nothing seems to work,

I also tried

adb shell dumpsys deviceidle force-idle

but this gives me the message below.

 Unable to go idle; not enabled

Please advise. I am using motorola Moto G 2nd generation android 6.0 and also used emulator x86_64 bit image with android studio version 1.5.1

Ahmed
  • 14,503
  • 22
  • 92
  • 150

4 Answers4

70

try using

adb shell dumpsys deviceidle enable

that should enable the deep and light idle modes, then use

adb shell dumpsys deviceidle force-idle
BrianMiz
  • 1,101
  • 1
  • 10
  • 15
2

Try this:

  1. Disconnect and reboot your device.
  2. Connect device and launch app from Android Studio, switch off the screen.
  3. In terminal:
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle force-idle

This works for me.

researcher
  • 1,758
  • 22
  • 25
2

try these commands for idle mode in emulator (you can use it in device also but if it is not working on device (clock timer or other reasons try these on emulator)

adb shell dumpsys deviceidle enable
adb shell dumpsys deviceidle force-idle

to check if device goes in idle mode or not try this command

adb shell dumpsys deviceidle get deep
Noaman Akram
  • 3,680
  • 4
  • 20
  • 37
1

It can sometimes misbehave. When it happend to me i used the command

   adb shell dumpsys battery reset

This will drain your battery. After letting it charge for sometime i used the below two commands

   adb shell dumpsys battery unplug
   adb shell dumpsys deviceidle step

Make sure you give the last command multiple times. Let me know if this works.

Ragesh Ramesh
  • 3,470
  • 2
  • 14
  • 20