I want to turn on the torch on the device by pressing the power button 3 times(or something convenient) and display a notification saying "Flashlight ON" and turn it off by simply swiping out(clearing) the notification.

I have achieved this by creating 2 macros in Macrodroid.

But I wanted to do the same exact thing with Tasker because obviously tasker can do a lot of things whereas macrodroid is limited to only a set of things and its not worth using both of them at the same time.

1 Answer 1


Here is a workaround you could use.

Create a Task to toggle torch ( alternatively get a TeslaLED plugin -it supports a lot of devices).

I am not sure if this is my device limitation but the Hardware state is only limited to media button and not power button but nevertheless I believe the outcome will be the same.

Profile State >> Hardware >> Media button (Check both held down and stop event)


Task 1 (entrance) You can name it TorchlightCtrl or anything.

  1. A1 Alert >> Torch

  2. A2 Alert >> Flash (text: "Flashlight ON" Enabled Long: On)

  3. A3 Alert >> Notify (e.g Torchlight Enabled)

Save and exit this Task

Create another task

Task 2 (exit)

  1. A1: Alert >> Notify Cancel (title: Torchlight Enabled) Press back to exit

  2. A2 Task >> Stop (Put the task created earlier -in this case TorchlightCtrl)

Explanation: Pressing the media button will trigger Task 1 (TorchlightCtrl) to flash the torch, and a persistent notification is displayed in the notification bar. Dismissing the notification will trigger Task 2 which stops Task 1, additionally turning off the trigger.

Unfortunately my device Camera light is not working so could not expiclitly test it, please give me feedback if it works or not, so I can further improve it. Cheers

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .