First, you don't need additional program to make your screen alive. Why use one trick pony app when Automagic can do it already?
Just create action Set Screen Timeout
, change to Never
and execute it manually, not need to make it becomes a flow. Then your screen will never sleep anymore. If at your phone, never sleep didn't work, let's say only max to 24 hours. Then you can use trigger Display State off
, add single action Turn Screen On
. I believe you should have disabled the keyguard already since you want the screen always on.
I make some assumption to make it easier to explain. You want the tablet screen always on (done already). When it is idle 10 seconds at home screen, launch IPcam app to monitor CCTV. If someone touch the screen, close the IPcam app and jumps back to home screen. To do something like this, you need to create 1 custom widget and 3 flows to accomodate the event. The widget will act somewhat just like a screen saver which will be dimissed when touch. You have to make sure automagic is granted Draw over other apps
permission. Or if you ROM has something like permission monitor, check it and make sure automagic is granted the windows popup permission.
Widget : Screen Saver
Create a custom widget as big as your tablet resolution. Pay attention to the default orientation you use. If you use the tablet in landscape mode, you should make the resolution in landscape mode as well. For example, 1080x1920. This widget can be make completely transparant or you can give some white transparant color or add some small object like a stars or something to indicate the widget is showing in front. Later you wanna add action to this widget to execute the complementary flow.
Flow 1 : Tablet Idle
This will detect when the tablet is idle, under one condition, you have to back at the default home launcher first.
Trigger : App Task Started
: Choose your home launcher.
Action 1 : Sleep
10s, or as long as you want for the Idle timer.
Action 2 : Launch App
, select the app you want launch (IPcam app or anything) and use Control UI (need accessibility) as needed to navigate to the menu until the intended view.
Action 3 : Show Custom Widget Overlay
, Overlay Name : Screen Saver
, choose the widget Screen Saver
, put the resolution of your tablet and check Clickable.
This flow detect when you are in home launcher and idle for as long as the sleep timer, it will launch the app and block the screen using the pseudo screen saver. Don't enable this flow yet!
Make sure you finished until flow 3 before trying this.
Flow 2 : Reset Idle
This will reset stop Tablet Idle flow and make sure it doesn't launch the app and show the widget while we are still using it.
Trigger : App Task Ended
: Choose your home launcher
Action 1 : Stop Flows
, Choose Tablet Idle flow.
This doesn't mean when your home launcher is ended/killed. It simply means when the launcher is not the foreground app. However this has limitation though. When you back to homescreen, Flow 1 has been triggered, and start counting down. If you still navigating to your app drawer, it won't trigger this Reset Idle flow. So you might get the widget shown even if you are still using it. So it requires the condition where you have setup your tablet properly so you won't be navigating the home screen anymore unless for the several seconds switching the app. You can increase the sleep timeout to make sure you have enough time for navigating.
There is a better way to replace this 2 flows, using single flow Trigger UI Event at the home launcher. However it requires accessibility and I don't know if your tablet implemented it properly (need JB 4.3+). It is also more complicated, need to use Info overlay to select the element. But won't suffer from this navigating app drawer locked out issue. If your tablet supports it, and you really need to make sure it works precisely, then I can show you the way.
Flow 3 : Screen Saver Unlock
Create a flow without any trigger. This flow 3 only need to be executed from Widget Screen Saver, so no trigger needed.
Action 1 : Hide Custom Widget Overla
y, choose the Screen Saver
Action 2 : Show Home Screen
. We don't need to kill the current running app, since we are going to open it again later. But if it is needed, you can add Kill App
after this action 2.
Then go back to Custom Widget Screen Saver > Clickable Actions > Add Click > Execute Flows
, choose Screen Saver Unlock
(this flow 3).
: Make sure you have add this clickable action to widget, and enable this flow before trying to show the widget
. If you show the overlay widget and don't have any means to hide it again, you will ended up blocking yourself and can't do anything to the whole screen anymore. You have to force restart the tablet (hold power button 10 seconds) or unplug the charging cable.
You can try this widget out by using another separated action Show Custom Widget Overlay
, but use lower resolution, example 360x640 (so it won't block the whole screen), executed it. And try to tap it to see if the widget disappeared (and you will jump back to homescreen). If it is working, then you can try to enable flow 1 and 2 now.
You can still add more action click to the widget. For example you can split the clickable part to 4 parts. Click top left to directly launch music app, click top right to launch youtube and etc. You can also add another time trigger to change the color of the widget based on time, or to put some extra information, or maybe the motion detection from the IPcam.