Page 1 of 1

Trigger Flashlight on

Posted: 12 Jan 2019 19:14
by tempe222
It would be useful to be able to count down after turning on the flashlight to turn it off again after X minutes, e.g. when it was turned on accidently, or when reading in the evening or putting the baby to sleep.

Re: Trigger Flashlight on

Posted: 14 Jan 2019 09:32
by Rafi4
hi
this trigger is already available.

trigger = system setting changed
category = system
name = torch_light
variable = torch

condition = torch == 1; true;
add actions which you want to true branch.

any doubts please post?

welcome

Re: Trigger Flashlight on

Posted: 14 Jan 2019 16:56
by Desmanto
This event is not created in every android, at least not at mine, RR 6.2.0 Oreo 8.1. I have checked the system setting and the LOS setting too, nothing change during the flashlight is on. Logcat only show some camera manager invoking the flashlight. No broadcast, no event created. But I can still use condition Flashlight on to check whether the flashlight is turned on.

So the only way to check it is using some periodic timer to check if the flashlight is on, then turn it off. But this is not the best. Maybe it is better just create a flow, which turn on flashlight and auto turn it off after several minutes. Next time, to use flashlight, create a shortcut to that flow and give it a flashlight icon.

Re: Trigger Flashlight on

Posted: 15 Jan 2019 00:25
by Rafi4
hi desmanto
this is working perfectly on my device Samsung Galaxy j2.
I am uploading flow. turn on flash light through Automagic or notification panel this flow is perfectly working. edit it as your needs

from record4

Re: Trigger Flashlight on

Posted: 15 Jan 2019 08:12
by tempe222
Thanks! This goes way beyond my current experience. How do I know the variable is "torch"?

And is the attached flow then correct?

Re: Trigger Flashlight on

Posted: 15 Jan 2019 08:40
by Rafi4
hi
In trigger you can find the variable "torch".
you may change it as you wish, if you named it as example
"light". change it in condition "expression" also as "light."

from record4

Re: Trigger Flashlight on

Posted: 15 Jan 2019 18:24
by Desmanto
@Rafi4 : Your flow use trigger Glovar dt, I don't know why you need that. Probably you uploaded the wrong flow. Maybe it is system setting changed. But not all android provide this value change when flashlight is on, so it depends on the phone. To perform action on notification, the screen doesn't need to be on, nor the notif bar should be pulled down. So no need to turn screen on, pull down the notif. Simply directly perform action on notif.

@tempe222 : if your phone set the value after turn on flashlight, you can find it in system setting. Create another flow, add trigger, System Setting Changed, system. Add another two same trigger, choose secure and global. Add condition debug dialog after it. Enable the flow and Turn on the flashlight. If the value is set, you should debug dialog pop up. If not (mostly likely nothing), then the system doesn't provide you the value for flashlight. Disable the flow afterward, or you will get a bunch of popup later.

Re: Trigger Flashlight on

Posted: 15 Jan 2019 21:40
by Rafi4
hidesmanto
thanks for your suggestion.

from record4

Re: Trigger Flashlight on

Posted: 16 Jan 2019 00:30
by Rafi4
hi