FORUMS
Remove All Ads from XDA

Using tasker to simulate power button

33 posts
Thanks Meter: 10
 
By snorrski, Member on 11th April 2017, 08:26 AM
Post Reply Email Thread
I want to use tasker to turn the screen off. Secure Settings > Lock Device forces me to use pin, which is not what I want, as I use a finger print scanner to wake my device. Shell > Input keyevent 26 does not work either, as I am not rooted (Huawei Mate 9 pro, doesn't seem to have a reliable root yet).

I have tried doing it with System > Send intent, but that seems to have no effect. I dont know if I am doing it wrong. I have also tried
Code:
terminal task
, with a code like this (and some variants of it), without success:

Code:
am start --user 0 -a android.intent.extra.KEY_EVENT --es KEYCODE_POWER ACTION_DOWN
I have also tinkered with

Code:
android.intent.action.SCREEN_OFF
...but with even less success.

Any ideas as how how I can get this to work? Either with terminal emulator or tasker send intent task?
 
 
11th April 2017, 09:03 AM |#2  
R4V3N-2010's Avatar
Senior Member
Flag Dals Långed
Thanks Meter: 311
 
Donate to Me
More
I think you can't do that cause you're using your Fingerprint. That is a security future and Tasker can't bypass it. Don't nail me on it cause I am not sure. Maybe someone else can prove me wrong.

Sent from my ONEPLUS A3003 using Tapatalk
11th April 2017, 10:45 AM |#3  
Senior Member
Flag Berlin
Thanks Meter: 119
 
More
Maybe you could setup a workaround for this. For example, you could lower the display timeout value to one second so your device locks itself.
(Don't forget to change the timeout back to your preferred value after another second!)
11th April 2017, 12:56 PM |#4  
OP Member
Flag Copenhagen
Thanks Meter: 10
 
More
Quote:
Originally Posted by digitalpig82

Maybe you could setup a workaround for this. For example, you could lower the display timeout value to one second so your device locks itself.
(Don't forget to change the timeout back to your preferred value after another second!)

Good idea. But the minimum is 7 seconds, which is too long to wait, for the solution to be worthwhile.
11th April 2017, 01:41 PM |#5  
OP Member
Flag Copenhagen
Thanks Meter: 10
 
More
I found a way to do it:
1: Create a task:
display > display timeout: 8 seconds
scene: Show scene: popup - display as overlay, blocking, full screen
2: create a profile for screen on, create task:
hide scene: popup
display > display timeout: 30 seconds
11th April 2017, 04:28 PM |#6  
Senior Member
Flag Berlin
Thanks Meter: 119
 
More
So you're hiding the ui with a black screen until the screen is really switched off after 8 seconds, right? But what happens when you press the back or home button within the 8 seconds? Does the scene disappear?
15th April 2017, 03:54 AM |#7  
greyhd's Avatar
Senior Member
Thanks Meter: 611
 
More
This is what I do. Just make a task with Run shell, no need for security settings app. In the command line type input keyevent 26. You then can add a short cut when you double tap the homescreen to turn off the screen.
The Following User Says Thank You to greyhd For This Useful Post: [ View ] Gift greyhd Ad-Free
8th May 2017, 02:29 PM |#8  
Senior Member
Flag Berlin
Thanks Meter: 119
 
More
@snorrski you might want to have a look at this:

https://forum.xda-developers.com/u/t...1#post72212441

It seems to be exactly what you wanted. It works without root and on my (unrooted) S7 Edge, I can still use the fingerprint sensor to unlock my device after locking it this way (input keyevent POWER).
The Following 3 Users Say Thank You to digitalpig82 For This Useful Post: [ View ] Gift digitalpig82 Ad-Free
8th May 2017, 08:49 PM |#9  
OP Member
Flag Copenhagen
Thanks Meter: 10
 
More
Quote:
Originally Posted by digitalpig82

So you're hiding the ui with a black screen until the screen is really switched off after 8 seconds, right? But what happens when you press the back or home button within the 8 seconds? Does the scene disappear?

Yes, exactly​. That's the way it is program.med for now.
8th May 2017, 08:50 PM |#10  
OP Member
Flag Copenhagen
Thanks Meter: 10
 
More
Quote:
Originally Posted by digitalpig82

@snorrski you might want to have a look at this:

https://forum.xda-developers.com/u/t...1#post72212441

It seems to be exactly what you wanted. It works without root and on my (unrooted) S7 Edge, I can still use the fingerprint sensor to unlock my device after locking it this way (input keyevent POWER).

Thank you! That does indeed look like what I need!
The Following User Says Thank You to snorrski For This Useful Post: [ View ] Gift snorrski Ad-Free
30th July 2019, 07:31 PM |#11  
Senior Member
Thanks Meter: 36
 
More
Quote:
Originally Posted by digitalpig82

@snorrski you might want to have a look at this:

https://forum.xda-developers.com/u/t...1#post72212441

It seems to be exactly what you wanted. It works without root and on my (unrooted) S7 Edge, I can still use the fingerprint sensor to unlock my device after locking it this way (input keyevent POWER).

@snorrski
I know it's been over 2 years since y'all had this discussion, but I hope this still reaches you.

The power button on my Mi A1 stopped working recently and I can't seem to find it's replacement flex cable anywhere. I'm entirely new to Tasker but I have been reading for hours now to find ways to use a screen based interaction (say a double tap on the screen) to simulate the Power button to turn the screen off while still being able to unlock my phone with my fingerprint scanner.

So far, I've understood that it is doable (with an article refering to input keyevent 26), even more so on Android Pie (with another article refering to using Global_Actions) than it was previously possible, but am entirely clueless on how. I also couldn't quite understand the process of using the remote ADB shell plugin you mention here.

Could either of the two of you please share a step-by-step how-to on how to achieve the same? It would really help a lot. Thank you

Note: I'm using unrooted Mi A1 running stock Android Pie with July 1st security patch.
Post Reply Subscribe to Thread

Tags
intents, screen off, tasker

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes