Buttons

Post your questions and help other users.

Moderator: Martin

Post Reply
Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Buttons

Post by Ankit » 04 Feb 2014 16:00

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............

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Buttons

Post by Martin » 04 Feb 2014 18:22

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

bindalji66
Posts: 12
Joined: 12 Sep 2013 03:57

Re: Buttons

Post by bindalji66 » 05 Feb 2014 03:58

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

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Buttons

Post by Martin » 05 Feb 2014 18:05

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

Post Reply