How to Shutdown on power loss with a wait timer incase power get's restored?

sebaskitten

New member
heya good day!

i am trying to make a digital car dashboard and all is going well so far.

but i cant figure out how to do the following with macrodroid.

if power (so the charger) get's disconnected. the device waits X amount of time before shutting down. if in that X amount of time power get's restored. the shutdown procedure get's aborted..

my device is fully rooted and running a custom firmware.

so far i've got it to instantly shut off when power get's disconnected if the device has been booted longer than 15 minutes. but that probably does not mean it'll shutdown the moment the 15 minutes pass. and it's not the way i wanted it to work anyway...

thank you in advance for your help!
 

sebaskitten

New member
nice thank you! that seems to work.

i got a small issue though, which might end up to data corruption...

if i try normal power off. nothing happens. if i try power off alternative. it seems to actually kill android in it's place.

if a sound is playing like the charge sound it'll loop the sound for a while after it killed android.

sometimes during a boot. it wil show up a warning (both from recovery and android itself) that the data partition is corrupted. a reboot fixes it. but still worrying.


is there a alternative way to initiate a safe shutdown? my device is rooted so anything should be possible.

my system is running android 10. lineage os 17.1 to be exact. running magisk for root
 
Top