Hi guys !
I am making GREAT functions with Automagic !
I just found out the shortcut trigger so I am asking here before doing something wrong or loose time:
Is there a way to make the shortcut do different things at each press ? For example turn on the flash light and then off after a second press...
If it is not possible is there an example on how to make this function with a widget ? Thank you in advance !!!
Hope to hear from you soon !
Shortcut double press
Moderator: Martin
Re: Shortcut double press
Hi,
You can use a regular shortcut trigger to execute a flow and then use a condition to switch between two branches. For the flashlight something like this could work:
-trigger Shortcut
-condition Flashlight On
--> true: -action Flashlight: Off
--> false: -action Flashlight: On
Another option would be by using global variables. Please check out flow Ringer Mode Switch in menu->Catalog (section Scripting). You could use a toggle widget to switch the global variable between true and false. Add the toggle widget to the home screen and set the global variable to global_switch, select a short title and press OK. The green color indicates when the global variable is set to true.
Regards,
Martin
You can use a regular shortcut trigger to execute a flow and then use a condition to switch between two branches. For the flashlight something like this could work:
-trigger Shortcut
-condition Flashlight On
--> true: -action Flashlight: Off
--> false: -action Flashlight: On
Another option would be by using global variables. Please check out flow Ringer Mode Switch in menu->Catalog (section Scripting). You could use a toggle widget to switch the global variable between true and false. Add the toggle widget to the home screen and set the global variable to global_switch, select a short title and press OK. The green color indicates when the global variable is set to true.
Regards,
Martin
Re: Shortcut double press
Reading the forum I adapted some solutions and I found out this easy perfectly working solution... is it as good as your one ?

The only "problem" is that there is a delay of almost 2 seconds between turning on the light while turning off is almost immediate... can I remove that "tunr-on-delay" time ?

The only "problem" is that there is a delay of almost 2 seconds between turning on the light while turning off is almost immediate... can I remove that "tunr-on-delay" time ?
Re: Shortcut double press
Hi,
Yes, your solution should also work.
Turning on the flashlight is quite slow on some devices since the camera has to be activated which controls the flashlight. The next version of Automagic should improve the speed on Android 6 where Google introduced a better API to control the flashlight.
Regards,
Martin
Yes, your solution should also work.
Turning on the flashlight is quite slow on some devices since the camera has to be activated which controls the flashlight. The next version of Automagic should improve the speed on Android 6 where Google introduced a better API to control the flashlight.
Regards,
Martin
Re: Shortcut double press
Thank you for your answer !
Anyway I think there is a partial solution because using some pre-made widgets (not with automagic) I can see the "flash light on" acting really quicker...
Anyway I think there is a partial solution because using some pre-made widgets (not with automagic) I can see the "flash light on" acting really quicker...