Screen Timeout Condition

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Screen Timeout Condition

Post by sitruk » 27 Apr 2018 14:26

- I have not seen this specific request.
- Screen Timeout Condition
- I am looking for a condition that will pair well with the Set Screen Timeout Action. I would like to ask the current state of the screen time out setting (Never, 30s, 10s, Is not #s, Is #s, etc).

Here is an example of the flow I would like to create.

Quick Settings tile ->
-------------Is Screen Timeout "Never"? ->
--------------------------------Yes -> Set Screen Timeout to "30s"
--------------------------------No -> Set Screen Timeout to "Never"

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Screen Timeout Condition

Post by digitalstone » 27 Apr 2018 15:53

My guess is:
That the Android api only is able to receive a number and then set that number as the timeout.
Getting back a value from, what has been set inside the system, is not what the api is capable of.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Screen Timeout Condition

Post by sitruk » 27 Apr 2018 16:23

digitalstone wrote:My guess is:
That the Android api only is able to receive a number and then set that number as the timeout.
Getting back a value from, what has been set inside the system, is not what the api is capable of.
Ahhh, ok. That sounds logical.

I don't want to derail this feature request, but I am looking for a way to make my example flow a reality even if it isn't identical.

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Screen Timeout Condition

Post by digitalstone » 27 Apr 2018 16:52

You could always make use of a global variable.

After each screen timeout action, just set a global variable with a script to match the number you just set.

Then whenever you need to know the timeout value, from any flow at all, you can just request that global variable instead.

This would be my alternative method.
Although i need to say that i'm still not sure about the api limitation i mentioned earlier.
Martin would definately know and most probably Desmanto as well.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Screen Timeout Condition

Post by sitruk » 27 Apr 2018 16:58

digitalstone wrote:You could always make use of a global variable.

After each screen timeout action, just set a global variable with a script to match the number you just set.

Then whenever you need to know the timeout value, from any flow at all, you can just request that global variable instead.

This would be my alternative method.
Although i need to say that i'm still not sure about the api limitation i mentioned earlier.
Martin would definately know and most probably Desmanto as well.

Excellent. Thank you for that. I will look into your suggestion as a solution while I wait for a definitive answer on the original request.

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

Re: Screen Timeout Condition

Post by Desmanto » 27 Apr 2018 17:26

You want to check the current screen timeout setting? Use action Init Variable System Setting, Category : System, Name : screen_off_timeout (just search "timeout" in the ellipsis), save to variabel setting. Evaluate this setting using expression and branch the flow accordingly.
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.

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Screen Timeout Condition

Post by sitruk » 27 Apr 2018 17:51

I actually used the global variable method and it works great!

At least I have options now.

Thank you for all your guidance!
Attachments
Screenshot_20180427-134852.png
Screenshot_20180427-134852.png (181.16 KiB) Viewed 16024 times

Locked