Page 1 of 1

Screen Timeout Condition

Posted: 27 Apr 2018 14:26
by sitruk
- 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"

Re: Screen Timeout Condition

Posted: 27 Apr 2018 15:53
by digitalstone
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.

Re: Screen Timeout Condition

Posted: 27 Apr 2018 16:23
by sitruk
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.

Re: Screen Timeout Condition

Posted: 27 Apr 2018 16:52
by digitalstone
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.

Re: Screen Timeout Condition

Posted: 27 Apr 2018 16:58
by sitruk
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.

Re: Screen Timeout Condition

Posted: 27 Apr 2018 17:26
by Desmanto
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.

Re: Screen Timeout Condition

Posted: 27 Apr 2018 17:51
by sitruk
I actually used the global variable method and it works great!

At least I have options now.

Thank you for all your guidance!