Are Doze Mode and Idle the same thing?

1k views Asked by At

I'm using Android Studio and i'm trying to test my app when using Doze mode. I've read some links already(including the android documentation about doze mode). However, i'm getting confused. Is there any difference between "IDLE" and "Doze mode"? It seems to me they are treated as the same thing whenever I read about them.

Moreover, I was expecting that after awakening from Doze Mode, the onCreateView() method would be called again in the activity. Is that correct? I've tried to force the Doze mode with ADB and awakening it later, launching the app, going to the activity I want to test, and then using:

adb shell dumpsys battery unplug

adb shell dumpsys deviceidle force-idle

adb shell input keyevent KEYCODE_WAKEUP

However, the onResume() method was called instead. If my expectation was wrong, both Doze mode and Idle should call onResume() after being awakened? I'm kinda confused with these two concepts. Can anyone help me, please?

1

There are 1 answers

1
Chrystian On

OnCreateView would not be called again after Doze mode ends. OnCreate would only be called if for some reason your app was killed during Doze mode. On Resume is called because you are returning to the activity or fragment after that screen was not in the foreground. I recommend you to read more on the Android lifecycle, and the difference between Oncreate vs on Resume onCreate vs. onResume/onRestart bevhaviour regarding member variables