How to find out that a device is disconnected

I want to do something when the mobile device closes, but I do not know what the method is; Could you tell me how to detect if the mobile device is disconnected?
I know the android.intent.action.BOOT_COMPLETED mobile phone reboot method, but I can not find the failure.

+6
android
source share
1 answer

http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN

public static final String ACTION_SHUTDOWN

Since: Level 4 API: Broadcast: The device shuts down. This is when the device is turned off (completely disconnected, not sleep). When the broadcast is completed, the final completion will be and all unsaved data is lost. Typically, applications do not need to access applications this, because the foreground will also be suspended. These are which can be sent by the system.

Constant value: "Android.intent.action.ACTION_SHUTDOWN"

Does it look like this? I just ran the google team and that was on the list of standard broadcasts. :)

+9
source share

All Articles