目录

Why does the watch receive the onHidden callback message 2 minutes after the screen is turned off?

Question

On the watch, it fails to receive the onPageShow callback after the screen is turned off or the onPageHide callback when the screen is turned on.

Solution

On wearable devices, the delayed callback mechanism is used to reduce power consumption. The application needs to wait for two minutes before receiving the window screen-off callback after the screen turns off. This is part of the window specifications for wearable devices. You can refer to the @ohos.power (System Power Management) documentation to detect whether the current device is active.