handling phone shutdown event in android

后端 未结 3 840
再見小時候
再見小時候 2020-12-03 03:04

Could you post a simple code to handle shutdown event. I need manifest and receiver.

I need the following: I have a service running in background and I want to detec

3条回答
  •  眼角桃花
    2020-12-03 03:53

    public static final String ACTION_SHUTDOWN

    Broadcast Action: Device is shutting down. This is broadcast when the device is being shut down (completely turned off, not sleeping). Once the broadcast is complete, the final shutdown will proceed and all unsaved data lost. Apps will not normally need to handle this, since the foreground activity will be paused as well.

    This is a protected intent that can only be sent by the system.

    Constant Value: "android.intent.action.ACTION_SHUTDOWN"

    And this ACTION_SHUTDOWN may differ from device to device

    Like HTC its android.intent.action.QUICKBOOT_POWEROFF

提交回复
热议问题