Detect screen touch

Post your questions and help other users.

Moderator: Martin

Post Reply
robchoc
Posts: 81
Joined: 20 Jun 2018 12:38

Detect screen touch

Post by robchoc » 11 Feb 2020 16:06

I have a simple loop:

Code: Select all

scroll=100;
loop=0;

while (loop <50)
{
sendKey(93);
sleep(scroll);
loop = loop + 1
}
Is there a way to exit this loop if the screen is touched?

Thanks for all the help.

User avatar
Desmanto
Posts: 2395
Joined: 21 Jul 2017 17:50

Re: Detect screen touch

Post by Desmanto » 11 Feb 2020 19:04

No direct way, as you need root and command Output trigger to detect the touch.

The better solution is to use full screen widget. Design a transparent widget as big as your screen resolution. Give action execute flow, which is designed to stop the flow with the CUI loop script. When executing CUI script, use show widget with clickable. The transparent widget will cover the whole screen. And when you touch it, it will execute the widget helper flow and hide the widget afterward. This gives the similar effect of touching the screen and stop the CUI script.

But be careful when testing full screen widget, as you might block yourself out and have to force restart the phone. Make sure you test the transparent widget as small resolution first, before making it bigger.

The concept maybe similar to this screensaver flow : viewtopic.php?f=3&t=6963&p=19026&hilit= ... ver#p19026
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200117 Official, Android Pie 9.0, Rooted.

Post Reply