Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,979 Members 46,593 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Scheduled Shutdown

Tip us?
 
Sagittarius0
Old
#1  
Junior Member - OP
Thanks Meter 1
Posts: 10
Join Date: Jul 2013
Clock [Q] Scheduled Shutdown

Hi,
I recently got fed up with forgetting to power off my nook. So I figured out I could use Tasker to shut it down at night when it is idle, etc., but I while I was testing it I realized that when my Nook is shut down, it shows the last state of the screen before having been shut down. It is quite annoying, especially that I cannot find a workaround, since Tasker cannot unlock the locked screen.

So, my question is, that does somebody know whether there is a shell command to power off the Nook like when you press the power off button?
Or any other suggestions would also be great.
 
OverByter
Old
#2  
OverByter's Avatar
Member
Thanks Meter 13
Posts: 81
Join Date: Nov 2010
Location: West Haven

 
DONATE TO ME
In my experience letting the nook go into standby for 8-12 hours before using it again uses less battery than shutting down completely and rebooting it.
OB

Sent from my SPH-D710VMUB using Tapatalk 2
 
wozhere
Old
(Last edited by wozhere; 24th May 2014 at 08:30 AM.)
#3  
Senior Member
Thanks Meter 61
Posts: 257
Join Date: Sep 2010
I use Quick Boot v4.2, Plus version which has an additional command useful for phones: Hot Boot. Free version is good enough for NST:
http://play.google.com/store/apps/de...ions.quickboot

I use a WiFi shutdown timer on my phone though, as sleep function on shoutcast radio.

P.S. As mentioned before in my apps listings thread for standby & screen blanking I use Screen Off FX:
http://play.google.com/store/apps/de...tool.offwidget
 
Sagittarius0
Old
#4  
Junior Member - OP
Thanks Meter 1
Posts: 10
Join Date: Jul 2013
Well, maybe I wasn't making myself clear enough. The most important part here is automation. So while screen off fx is awesome, I can't really use it in this situation since my screen is already locked when I want to turn my Nook off.

The thing I am searching for is a command or an app that could shut down my Nook (even when my screen is locked) in a way that it shows the usual "Your Nook has turned off completely" picture. (Every app that I tried has made the Nook show the screen that is has shown before having been shut down.) And I would like to do all of that automated, probably with Tasker.
 
cuff21
Old
#5  
Junior Member
Thanks Meter 2
Posts: 3
Join Date: May 2014
Quote:
Originally Posted by Sagittarius0 View Post
Well, maybe I wasn't making myself clear enough. The most important part here is automation. So while screen off fx is awesome, I can't really use it in this situation since my screen is already locked when I want to turn my Nook off.

The way I would do it is unlock the screen, overlay an image of whatever you want to be shown using a scene, and then shutdown.
To unlock the screen, try Simulating the "n" button command with tasker to unlock the screen before shutting down. (assuming slide to unlock is disabled):

Procedure for simulating button:
  1. In your Tasker task, Create a new Run Shell Action. (Found in the "Script" category)
  2. In the command section, put the following:

    Code:
    Select Code
    sendevent /dev/input/event1 1 102 1
    sendevent /dev/input/event1 0 0 0
    sendevent /dev/input/event1 1 102 0
    sendevent /dev/input/event1 0 0 0
    This will send a press and a release event of the n button.
  3. Check the Use Root Option.

NOTE: If this is the first time you've used root with tasker, the root confirmation dialog will appear. Make sure to check the always allow option so that it doesn't pop up again.


Just For Reference:

If you would want to use other buttons do the following:

Replace 102 with:
  • Power Button: 116
Replace event1 with event0 AND 102 with:
  • Top Left Page Button: 412
  • Bottom Left Page Button: 139
  • Top Right Page Button: 407
  • Bottom Right Page Button: 158

Good Luck!
The Following User Says Thank You to cuff21 For This Useful Post: [ Click to Expand ]
 
Sagittarius0
Old
#6  
Junior Member - OP
Thanks Meter 1
Posts: 10
Join Date: Jul 2013
Absolutely woderful!
This is exactly how I wanted to do it.
It works perfectly, thank you very much.
 
Renate NST
Old
#7  
Renate NST's Avatar
Recognized Contributor / Recognized Developer
Thanks Meter 783
Posts: 1,956
Join Date: Feb 2012
Location: Boston
Pushing stuff into /dev/input is lower level than it need be.
You'll be working with scan codes there.
In a shell this sends a press of the power button (using a KEYCODE)
Code:
Select Code
input keyevent 26
Shutdown is easy enough (with one small hitch).
Simply send a android.intent.action.ACTION_REQUEST_SHUTDOWN
The problem is that this is a privileged intent and can only be sent by system apps.
System apps are those that have the system signature.
You can do that by re-signing your system.
You need to have android.permission.SHUTDOWN in the manifest.

 
Sagittarius0
Old
#8  
Junior Member - OP
Thanks Meter 1
Posts: 10
Join Date: Jul 2013
Quote:
You can do that by re-signing your system.
Well, how can I do that?

And does this command you mentioned have the same efect as reboot -p?
 
cuff21
Old
#9  
Junior Member
Thanks Meter 2
Posts: 3
Join Date: May 2014
Quote:
Originally Posted by Sagittarius0 View Post
Absolutely woderful!
This is exactly how I wanted to do it.
It works perfectly, thank you very much.
Glad I could help!

Quote:
Originally Posted by Renate NST View Post
Pushing stuff into /dev/input is lower level than it need be.
You'll be working with scan codes there.
In a shell this sends a press of the power button (using a KEYCODE)
Code:
Select Code
input keyevent 26
Ok, good to know. I just went for the scan codes because I knew how to quickly get them from shell getevents.

Quote:
Originally Posted by Sagittarius0 View Post
Well, how can I do that?

And does this command you mentioned have the same efect as reboot -p?
If all your looking for is to do a shutdown or reboot, and are already using a Tasker task, the action Misc > Reboot has the ability to shutdown or do a reboot. My guess is that it does exactly what Renate NST is telling you to do - send a shutdown intent - behind the scenes. Granted, I don't know, and I don't have Tasker installed on my nook so I can't confirm that it will actually work, I have just used Tasker on other devices and it seems to work fine.

Just seems like the easiest, cleanest way would be to keep all the actions under one roof.
The Following User Says Thank You to cuff21 For This Useful Post: [ Click to Expand ]
 
Sagittarius0
Old
#10  
Junior Member - OP
Thanks Meter 1
Posts: 10
Join Date: Jul 2013
Quote:
Originally Posted by cuff21 View Post
I don't have Tasker installed on my nook so I can't confirm that it will actually work
It does work seamlessly.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

[OTA Captured] Verizon LG G Pad 8.3 Finally Gets Official KitKat Update

It’s been almost nine months since the LG G Pad … more

Enjoy Wallpaper Overload with PhotoPhase

We don’t usually feature live wallpapers on the XDA Portal unless they are somewhat innovative … more

Monitor What Your Phone’s Camera Sees with Android Wear

Having a smart device strapped to your wrist certainly has its merits. A … more

Mod Lets You Have Stereo Speakers on Your Sony Xperia Z1 (Sort Of)

The stereo speakers onthe Sony Xperia Z2areprobably a relatively large … more