Difference between Intent.ACTION_REBOOT and Intent.ACTION_SHUTDOWN
Asked Answered
D

2

7

I am trying to receive (with BroadcastReceiver) the action of shutting down, booting and rebooting.

I searched a lot, but I could not figure out what is the difference between Intent.ACTION_REBOOT and Intent.ACTION_SHUTDOWN, and when is Intent.ACTION_REBOOT called (or should I say "broadcasted").

Can please someone explain that for me?

Defray answered 29/7, 2013 at 7:3 Comment(3)
What exactly is not clear? One is for rebooting the device, the other is for complete shutdown.Honey
Intent.ACTION_REBOOT is never triggered...Defray
That's because it's only meant for use by the platform.Honey
D
8

Intent.ACTION_REBOOT is triggered if Reboot/Restart command initiated. This Action only can be used by System code/apps.

Intent.ACTION_SHUTDOWN :- is triggered when SHUTDOWN command is initiated or the device is being shutdown. After this Action is completed device will start shutdown process and any unsaved data will be lost.

You can also read what docs says here >> ACTION_REBOOT and ACTION_SHUTDOWN

Disini answered 29/7, 2013 at 7:8 Comment(5)
So how can you explain that when I reboot my device, the ACTION_REBOOT is not triggered?Defray
Because it is defined only for system apps as par the documents.Disini
So when does it happen?Defray
it isn't for you, forget it, Use SHUTDOWN instead.Disini
Just for anyone that might want to know, not even with the REBOOT permission (system permission) I can detect ACTION_REBOOT on Lollipop 5.1. Might mean that when the system reboots the device, it sends the broadcast with some permission that apps need to have to detect it. Maybe a special (signature?) permission, undocumented and not on hidden/internal APIs (or I'd see it). Pity. Guess I'll have to stick with SHUTDOWN only, even on reboots.Canorous
B
4

Intent.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.

Intent.ACTION_REBOOT

Broadcast Action: Have the device reboot. This is only for use by system code. This is a protected intent that can only be sent by the system.

Bala answered 29/7, 2013 at 7:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.