Tasker is an Android app that lets you specify “contexts” (specific states of the phone), and carry out actions depending on these contexts. An example use-case might be something like “when I am connected to my home WiFi network, disable my screen lock”.
One of the actions available under Tasker is “Run Shell”, which lets you issue shell commands to the underlying operating system. To achieve your desired effect, you could:
Acquire Tasker (a few dollars)
Set it up to run with root privileges
Set a context of “between 11pm and 6am”
Set an action of the shell command “su -c shutdown -h now” (or something similar) to run under that context
This does seem quite hazardous, though. If an emergency happened at 3am, I’m pretty sure I’d want my phone easily available and usable.
ETA: I just Googled to see if there was an existing recipe for this. It turns out Android doesn’t have a conventional shutdown terminal command, but does have the “reboot” command, with the switch -p for powering down. Tasker also has a “reboot” under System->Misc, with a power-down option on rooted phones. This can absolutely do what you want it to do. Just don’t go having any emergencies between 11 and 6.
Thanks! This will be useful for me as well, it definitely seems better than my current solution: leaving my cell phone locked in my office(EDIT: at work).
I tried leaving it in another room for a while, but that lead to other problems, including trips to the other room at night to just look at one more message etc
A general observation on Tasker: when I first got it (a few years ago) I thought I’d use it for all sorts of things. In reality, whenever I set something up in Tasker, it’s usually either superseded by a more appropriate service or app a few months later, or broken by security fixes in subsequent versions of Android.
None of them were that important, really. They were more customisations to how I wanted the device to work. “Make sure GPS is turned on when Maps is turned on” sort of thing (which you now can’t do without rooting the device and jumping through a few hoops, so I just turn it on manually these days).
I had some stuff to conserve and report on battery consumption, which now has a zillion different apps. I also had some location-based contexts and automatic email actions which are now handled by IFTTT. It’s easy to forget how rudimentary smartphone apps and services were, even just a few years ago.
Made the phone report it’s location if you texted it the password. Security updates added hoops to jump through, and FindMyDroid came out for free with all the functionality.
Made the phone autoplay music when headphones were plugged in. I stopped needing these when I got a new car with a bluetooth stereo and stopped using the aux plug in.
Made the phone report it’s location if you texted it the password. Security updates added hoops to jump through, and FindMyDroid came out for free with all the functionality.
Thank you kind stranger for showing me something new. I’m glad to have learnt that.
But to paint the full picture, I used that location password to find my lost phone very rarely. It was mostly used during festivals, conventions, and travelling so that my friends and co-travelers could easily find me. People are uncomfortable adopting it, but it is a real easy fix to the ‘I’m here, where are you?’ coordination problem.
Tasker is an Android app that lets you specify “contexts” (specific states of the phone), and carry out actions depending on these contexts. An example use-case might be something like “when I am connected to my home WiFi network, disable my screen lock”.
One of the actions available under Tasker is “Run Shell”, which lets you issue shell commands to the underlying operating system. To achieve your desired effect, you could:
Acquire Tasker (a few dollars)
Set it up to run with root privileges
Set a context of “between 11pm and 6am”
Set an action of the shell command “su -c shutdown -h now” (or something similar) to run under that context
This does seem quite hazardous, though. If an emergency happened at 3am, I’m pretty sure I’d want my phone easily available and usable.
ETA: I just Googled to see if there was an existing recipe for this. It turns out Android doesn’t have a conventional shutdown terminal command, but does have the “reboot” command, with the switch -p for powering down. Tasker also has a “reboot” under System->Misc, with a power-down option on rooted phones. This can absolutely do what you want it to do. Just don’t go having any emergencies between 11 and 6.
I was going to say this too, it’s a good point. Potential fix: have a cheap non-smartphone on standby at home.
I already have another phone. Yes, this is a good point though.
Thanks! This will be useful for me as well, it definitely seems better than my current solution: leaving my cell phone locked in my office(EDIT: at work).
I tried leaving it in another room for a while, but that lead to other problems, including trips to the other room at night to just look at one more message etc
Sorry, I meant my office at work (yeap...). Fixed that.
That’s great!
I’ll see if I can implement this.
A general observation on Tasker: when I first got it (a few years ago) I thought I’d use it for all sorts of things. In reality, whenever I set something up in Tasker, it’s usually either superseded by a more appropriate service or app a few months later, or broken by security fixes in subsequent versions of Android.
What are the most important things you replaced with other apps?
None of them were that important, really. They were more customisations to how I wanted the device to work. “Make sure GPS is turned on when Maps is turned on” sort of thing (which you now can’t do without rooting the device and jumping through a few hoops, so I just turn it on manually these days).
I had some stuff to conserve and report on battery consumption, which now has a zillion different apps. I also had some location-based contexts and automatic email actions which are now handled by IFTTT. It’s easy to forget how rudimentary smartphone apps and services were, even just a few years ago.
Made the phone report it’s location if you texted it the password. Security updates added hoops to jump through, and FindMyDroid came out for free with all the functionality.
Made the phone autoplay music when headphones were plugged in. I stopped needing these when I got a new car with a bluetooth stereo and stopped using the aux plug in.
Even without an App there’s also the Android Device Manager.
Thank you kind stranger for showing me something new. I’m glad to have learnt that.
But to paint the full picture, I used that location password to find my lost phone very rarely. It was mostly used during festivals, conventions, and travelling so that my friends and co-travelers could easily find me. People are uncomfortable adopting it, but it is a real easy fix to the ‘I’m here, where are you?’ coordination problem.