how to handle sleep mode enter in android?

2019-07-04 03:25发布

问题:

I didn't find it anywhere, how can I handle entering sleeping mode in android? I want to do something when android device entered to the sleep mode? Is this possible or is there anyway to handle it?

回答1:

Just make this by using BroadCastReceivers for system-calls (wakeup/sleep)

Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?



回答2:

how can I handle entering sleeping mode in android?

Generally, you don't. There is nothing you need to do related to sleep mode.

I want to do something when android device entered to the sleep mode?

I certainly hope not.