I want to do something when the mobile device is closing, but I don't know what is the method; could you tell me how to detect if mobile device is shutting down?
I know the method about mobile restart android.intent.action.BOOT_COMPLETED
, but I cannot find similar power off.
Press the “Power” button on your cellphone to determine if it is powered off. The display on most cell phones will turn on once the button is pressed. If the phone is locked, the lock screen is displayed.
An Android phone can be found through the Android Device Manager. To find your phone, simply go to the Find My Device site and log in using the Google account that is associated with your phone. If you have more than one phone, choose the lost phone in the menu at the top of the screen.
Can a phone be tracked if it's turned off? A phone that is turned off is difficult to track because it stops sending signals to cell towers. However, the service provider or internet provider can show the last location once it's switched back on.
Shutting off your phone will clear any apps that are running in the background and get rid of anything that's draining your battery. Shutting down your phone can also help solve network connectivity problems. Smartphones will occasionally lose connection with your mobile network.
http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN
public static final String ACTION_SHUTDOWN
Since: API Level 4 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"
This would appear to be it? I just Googled your command and it was on the Standard Broadcast Actions list. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With