Hi,
I have created a flow to use my smartwatch to take a picture with my phone.
I want to use the standard camera app and not the automagic "take picture" action, as I want to be able to set the focus and camera mode first.
So all I want automagic to do is to click the camera button to take the picture. I tried the control ui click(coordinates) action, but it does not work. I even double checked the coordinates on a screenshot (using photoshop). The flow executes, but it does nothing. I´m using a galaxy s4 and the stock camera app can also use the volume buttons to take a picture. So eventually I managed to get it to work by creating a flow that sets the default input method to automagic, follow by a control ui sendkey(25) and then it sets the input method back to the normal keyboard. But this solution only works on a rooted phone, so I can´t use it on a different phone that´s not rooted.
The solution works, but I was wondering if there isn´t a more elegant way of doing this? And I don´t really understand why the click command doesn´t do the trick...?
Remote Camera trigger
Moderator: Martin
Re: Remote Camera trigger
Depending on how the target app's ui has been made the Control ui action may or may not work. If it doesn't work, there's not much you can do without root.
One workaround for rooted device is execute root command action: "input tap <x> <y>".
One workaround for rooted device is execute root command action: "input tap <x> <y>".
Re: Remote Camera trigger
Check whether your camera app offers shortcuts to various actions, by creating an Automagic action "Shortcut", them looking at the list of apps whether your camera app is among those.
Re: Remote Camera trigger
Thanks for your replies,
@Murtuma: I tried your idea, but it also doesn´t work. I double checked the coordinates with the developer tool overlay and even swapped the x and y coordinates to make sure.
@bushmills
Tried your idea as well, but the stock camera app is not even listed in the shortcuts list. Was worth a try though.
@Murtuma: I tried your idea, but it also doesn´t work. I double checked the coordinates with the developer tool overlay and even swapped the x and y coordinates to make sure.
@bushmills
Tried your idea as well, but the stock camera app is not even listed in the shortcuts list. Was worth a try though.
Re: Remote Camera trigger
Unfortunately I don't have an S4 anymore but the stock camera app on an S5 seems to not provide the required information for control UI to press buttons (Show overlay control->INFO in Control UI shows no green areas at all in the camera app).
Your solution to simulate keyboard input is probably the best one.
Your solution to simulate keyboard input is probably the best one.
Re: Remote Camera trigger
@Martin
I also tried the "show overlay" and it doesn´t show anything on the S4 camera app either.
Just for my understanding - I always thought that the control ui click command simulates a mouse click? But wouldn´t it then have to work in any app?
I´ll try it with a mouse when I get back from work to see what happens
I also tried the "show overlay" and it doesn´t show anything on the S4 camera app either.
Just for my understanding - I always thought that the control ui click command simulates a mouse click? But wouldn´t it then have to work in any app?
I´ll try it with a mouse when I get back from work to see what happens

Re: Remote Camera trigger
Technically it's not simulating a mouse click or touch on the display. Each regular control element like a button or a text field supports some high level commands like 'click', 'longclick' or 'setText' which are meant to be used by apps designed to help people with disabilities.
Automagic can query the supported commands for each control and the bounding rectangle on screen using the accessibility service. This is more or less the information that's provided when the overlay control is used.
When a script in action Control UI is executed, Automagic tries to find the control element at the given coordinate (or by the contained text). Automagic then executes the desired high level command, but it does not actually simulate a touch on coordinate X/Y.
Apps that use the regular control elements provided by the official Android API usually work quite good since the high level commands are directly built-in to those controls.
Apps like games (or the Samsung camera app) can also decide to use their own home grown control elements that don't support the high level commands. Automagic therefore can not show any information for such controls or execute any command.
Android N seems to allow accessibility services to simulate touch gestures. So it might be possible that I can extend Control UI to take advantage of the new features and make clicks also work in the Samsung camera app.
Automagic can query the supported commands for each control and the bounding rectangle on screen using the accessibility service. This is more or less the information that's provided when the overlay control is used.
When a script in action Control UI is executed, Automagic tries to find the control element at the given coordinate (or by the contained text). Automagic then executes the desired high level command, but it does not actually simulate a touch on coordinate X/Y.
Apps that use the regular control elements provided by the official Android API usually work quite good since the high level commands are directly built-in to those controls.
Apps like games (or the Samsung camera app) can also decide to use their own home grown control elements that don't support the high level commands. Automagic therefore can not show any information for such controls or execute any command.
Android N seems to allow accessibility services to simulate touch gestures. So it might be possible that I can extend Control UI to take advantage of the new features and make clicks also work in the Samsung camera app.
Re: Remote Camera trigger
Just FYI: Simulating an ENTER keypress could work, too. At least that's what my remote bluetooth trigger does.
BlackBerry KEY2, Android 8.1.0