Trigger when idle

Post your questions and help other users.

Moderator: Martin

Post Reply
holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Trigger when idle

Post by holymoz » 09 Jul 2019 10:40

Hi, My phone often does not turn off the screen when I don't use it.
I still have the screen on and consumes battery. Is There a trigger that can sense when phone is not used even with the screen on? Thanks

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: Trigger when idle

Post by Wibbly » 09 Jul 2019 11:09

Depends how you define "idle".

- Is, say, watching a video and not touching the phone, etc. 'idle''? I would say not
- Is it being on the home screen and not touching it 'idel'? Maybe
- etc.

If the normal screen timeout is not working, you need to investigate why?

holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Re: Trigger when idle

Post by holymoz » 09 Jul 2019 14:04

the normal screen timeout not works everytime, sometimes the screen doesn't go off.
as you say watching videos is not idle, the trigger must act when phone is not used by any apps on screen

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Trigger when idle

Post by anuraag » 09 Jul 2019 14:35

You can try creating a flow with ui event trigger. Set multiple triggers of ui event. Like Component clicked, component long clicked, focused etc. Set flow execution policy to "Stop the currently executing instance and then execute the newer instance". Add a script to set a global_variable to 30sec after trigger.

Create another flow with global_variable (created from previous flow) as trigger. Use whatever method available for turning screen off.

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: Trigger when idle

Post by Wibbly » 09 Jul 2019 14:48

anuraag wrote:
09 Jul 2019 14:35
You can try creating a flow with ui event trigger. Set multiple triggers of ui event. Like Component clicked, component long clicked, focused etc. Set flow execution policy to "Stop the currently executing instance and then execute the newer instance". Add a script to set a global_variable to 30sec after trigger.

Create another flow with global_variable (created from previous flow) as trigger. Use whatever method available for turning screen off.
I think this won't work if you are, say, watching a video. Maybe you have to have a condition that it's on the home screen too?

@holymoz: But as I said, I would first get to the bottom of why "the normal screen timeout not works everytime, sometimes the screen doesn't go off". It sounds like a bad app is making this happen (keeping the screen on). Or maybe you have another flow that has left the screen to a very long timeout?

Maybe use a ui event trigger flow as suggested by @anuraag with the action to just explicitly set (i.e. reset) the screen timeout to a low value, but this is putting a plaster over why it's not turning off when it should anyway, not fixing the root problem.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Trigger when idle

Post by anuraag » 09 Jul 2019 14:58

Here an extra flow will be need with trigger "app task started" which will disable ui event and global_variable trigger. And "app task ended" will enable them.

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

Re: Trigger when idle

Post by Desmanto » 09 Jul 2019 17:15

@holymoz : I agree with Wibbly, you should find the root cause, instead of using Automagic to solve the bad outcome.

But if you still need to have trigger on idle, you can take a look at my screen saver flow : viewtopic.php?f=3&t=6963
This will trigger when you don't touch the screen for some period. But you will have a flow always running background (the sleep action), so it is not feasible to save your battery. I can modify it to glovardt version if you need a longer period, but I think it doesn't worth it. You should investigate the root instead, rather than creating flow for alternative solution.

As pointed by anuraag, you can use app task started/ended to disable/enable the always running flow when opening certain apps.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Re: Trigger when idle

Post by holymoz » 09 Jul 2019 18:06

Thanks to all, will try something and search for the cause

Post Reply