Hi There ,
I was working on a Flow that makes the phone Switch Songs (NEXT / PREVIOUS) in Music Player by PRESSING the VOLUME UP / DOWN (Hardware Buttons) .
I Needed this flow and found it very Useful when DRIVING a CAR.
And if the phone has a PASS or PIN, U'll have to take time opening it then Switching NEXT / PREVIOUS.
I made That Flow Using TRIGGER: Audio Volume. by watching the volume goes Up and Down When H.W Buttons were pressed, It's a Complicated method..
If There was a ( BUTTON-PRESS TRIGGER ) It will be Much Easier
I Hope It Will be Something Like This:
TRIGGER: BUTTON PRESSED.
Select Button: Volume UP, Volume DOWN, HOME, MENU, BACK, LOCK, CAMERA...etc.
and if you can add BUTTON PRESS DURATION Option, it will be AWESOME
Thanks a lot
Your Efforts are Appreciated
BUTTON Pressed-Trigger
Moderator: Martin
Re: BUTTON Pressed-Trigger
Hi,
I think it's not possible to do this in general on an unmodified version of Android. You could try to use root with trigger Command Output: while true; do getevent -c 1 -l; sleep 1; done to react to input in general. You would still have to filter for the right output (like matches glob *KEY_VOLUMEDOWN*DOWN*). But that's all very device specific so I can not add support for this in Automagic as a built-in trigger.
Regards,
Martin
I think it's not possible to do this in general on an unmodified version of Android. You could try to use root with trigger Command Output: while true; do getevent -c 1 -l; sleep 1; done to react to input in general. You would still have to filter for the right output (like matches glob *KEY_VOLUMEDOWN*DOWN*). But that's all very device specific so I can not add support for this in Automagic as a built-in trigger.
Regards,
Martin
Re: BUTTON Pressed-Trigger
Bro, go and try xposed additions pro! A module for modification of button actions alone!, u will get al those function, but your device needs to be rooted and should have xposed installer installed!
Re: BUTTON Pressed-Trigger
Hi Martin.Martin wrote:Hi,
I think it's not possible to do this in general on an unmodified version of Android. You could try to use root with trigger Command Output: while true; do getevent -c 1 -l; sleep 1; done to react to input in general. You would still have to filter for the right output (like matches glob *KEY_VOLUMEDOWN*DOWN*). But that's all very device specific so I can not add support for this in Automagic as a built-in trigger.
Regards,
Martin
Thanks for your suggestion, I tried to create a flow as you described but I failed miserably. Could you please post a example XML with the basics?
Re: BUTTON Pressed-Trigger
Hi,
Please try following flow:
http://automagic4android.com/flow.php?i ... 24bd50e3a8
The flow imports to a flow group called _test. Please note that this flow requires a rooted device.
The trigger uses command getevent to listen for input events and executes a vibrate action when the volume down key is pressed down.
When the flow does not work, edit the trigger, press button Test command... and check if the log prints some information when the volume keys are used.
You could optimize the command to listen only to the input device producing the volume key events. To do so check the output using Test command... and then change the command to something like this:
while true; do getevent -c 1 -l /dev/input/event2; sleep 1; done
where /dev/input/event2 should be set to the value seen in the output of the trigger.
Regards,
Martin
Please try following flow:
http://automagic4android.com/flow.php?i ... 24bd50e3a8
The flow imports to a flow group called _test. Please note that this flow requires a rooted device.
The trigger uses command getevent to listen for input events and executes a vibrate action when the volume down key is pressed down.
When the flow does not work, edit the trigger, press button Test command... and check if the log prints some information when the volume keys are used.
You could optimize the command to listen only to the input device producing the volume key events. To do so check the output using Test command... and then change the command to something like this:
while true; do getevent -c 1 -l /dev/input/event2; sleep 1; done
where /dev/input/event2 should be set to the value seen in the output of the trigger.
Regards,
Martin
Re: BUTTON Pressed-Trigger
Hey Martin.Martin wrote:Hi,
Please try following flow:
http://automagic4android.com/flow.php?i ... 24bd50e3a8
The flow imports to a flow group called _test. Please note that this flow requires a rooted device.
The trigger uses command getevent to listen for input events and executes a vibrate action when the volume down key is pressed down.
When the flow does not work, edit the trigger, press button Test command... and check if the log prints some information when the volume keys are used.
You could optimize the command to listen only to the input device producing the volume key events. To do so check the output using Test command... and then change the command to something like this:
while true; do getevent -c 1 -l /dev/input/event2; sleep 1; done
where /dev/input/event2 should be set to the value seen in the output of the trigger.
Regards,
Martin
Thanks for the example, it really helped me.
Here the result, a flow (well, actually two) to skip Spotify tracks using the volume key long press.
Feel free to take a look and suggest improvements.
Thanks.
- Attachments
-
- exported_data_20150406_074708.xml
- (11.44 KiB) Downloaded 1541 times
Re: BUTTON Pressed-Trigger
Since Android 6, the key recognition does not work anymore.
Is there a workaround?
Is there a workaround?
Re: BUTTON Pressed-Trigger
Hello Martin, the flow you posted works fine for my needs (I use it for camera key).
I'd like to know which kind of impact on battery life it has.
I mean, does it check in loop every 1 sec?
Moreover, on the app store there s an app called Button Remapper that uses an accessibility service to remap hardware keys. Would it be possible to do the same with automagic's service (in terms of trigger)?
I'd like to know which kind of impact on battery life it has.
I mean, does it check in loop every 1 sec?
Moreover, on the app store there s an app called Button Remapper that uses an accessibility service to remap hardware keys. Would it be possible to do the same with automagic's service (in terms of trigger)?
Re: BUTTON Pressed-Trigger
On my Xperia stock 6.0.1 Rom it works fineSarolf wrote:Since Android 6, the key recognition does not work anymore.
Is there a workaround?