Page 1 of 1

Buttons

Posted: 04 Feb 2014 16:00
by Ankit
Hi,
How to long press home button or volume up/down button or power button of the phone using automagic.

And how to add this function in trigger??


Actually i want to take screenshot by long pressing home key or volume up/down key............

Re: Buttons

Posted: 04 Feb 2014 18:22
by Martin
Hi,

Many devices already support a way to take screenshots by pressing power/volume/home buttons in some way. What device are you using?

Detecting hardware keys is quite difficult and requires a rooted device with command getevent.
Starting with the next version of Automagic you could use a trigger Command Output that constantly checks for button down/up events of the volume and power keys and execute a flow based on this. There are currently some issues in the new trigger Command Output that will be fixed in the next EAP version so I would not try to use this trigger at the moment.
The actual commands to use are very device specific but I can post a short tutorial in the forum to show how this can be done on a Nexus 5 after the new version is released on Google Play.

Regards,
Martin

Re: Buttons

Posted: 05 Feb 2014 03:58
by bindalji66
Hi,

And how to long press the home key through action ??

Please give me the command to do the same as i was unable to find it after searching a lot........

Thanx in Advance!! :D :D

Re: Buttons

Posted: 05 Feb 2014 18:05
by Martin
Hi,

Argh, I completely misunderstood your post, you want to send the keys and not detect the keys :D
In this case you might need to use the sendevent command. Here is a starting point: http://android.stackexchange.com/questi ... -sendevent

Some devices also support the command screencap to make screenshots. Following action should work when your device supports this command:
Execute Root Command: screencap -p /storage/emulated/0/screenshot.png

Regards,
Martin