How to use Tasker to get LED notifications
Some phones come with notification LED lights already installed, and that’s a feature that some people simply can’t live without. But for those of us with phones that don’t have that built in, there are apps that allow you to use the camera LED as a makeshift notification LED. And if you have Tasker, you can extend the functionality of both those methods.
Tasker has actions built in for controlling both notification LEDs and camera LEDs (through TeslaLED). The location of both is the Alerts part of Tasker, and the available settings depend on which method you use. For true notification LEDs, you can specify the color and duration of the flash, assuming the phone supports those colors. For the camera LED, called Torch in Tasker, you basically have to use a more primitive method of turning it on, then using the Wait action under Task, and then turn it off again – and you obviously can’t change the color of that LED. I ended up using a roughly 500 millisecond wait between turning the “Torch” on and off, meaning the camera LED flashes for about half a second.
The ability to customize exactly how the LEDs should behave is one advantage over getting a ready-made solution. You can also combine the LED notifications with other things, like sound notifications, vibrations, and so on. As for tying these into calls, SMS, email, and other notifications, the method varies. The Event category of Tasker’s contexts have both Phone Ringing and Received Text available, meaning that Tasker can detect those directly. An example setup would be Phone Ringing -> Torch on, wait 500ms, Torch off. This example will make the camera LED flash for 0.5 seconds when the phone rings. Using the Wait action, it’s possible to make it flash repeatedly, every 5 seconds, or essentially any other configuration. SMS is essentially the same thing, using Received Text as the trigger. Both these also have more attributes you can configure, like number, allowing you to have different LED patterns of LED/vibrate/sound combos depending on the sender/caller.
For email, this is easiest if you’re using the K-9 email client. Then you have a context (trigger) specifically for received email, and the setup is otherwise like above. I had to eventually give up on K-9 however due to the message flash refreshment issue getting to be too much. For Gmail, other email clients, Facebook messages, Twitter mentions, and anything else you can think of, the key is in Tasker’s ability to read notifications. This requires that you have given it access to that in accessibility settings on your device, but once you do, Tasker is able to read notifications when they happen (not if they’re already in the notification bar). This context is in Events/UI in the context picker. It has to configuration methods, Owner Application and Title. I haven had some issues with the Title method, which essentially matches text in the notification, but the Owner Application system seems to work well. If you e.g. set it with Gmail as the owner application, it will trigger whenever Gmail displays a notification, which will likely be when an email just came in. Similarly, setting it to Facebook, Twitter, or other apps that have notifications, would enable LED notifications for those. That’s quite a compatibility list when the Flashlight Alerts app mentioned earlier only supports SMS and calls.
An example profile that flashes the camera LED for 0.5 seconds when Gmail receives a notification can be downloaded from here and imported straight into Tasker.
The final reason why this is a potentially more powerful way of dealing with LED notifications is tying it into other tasks. As an example, my Gmail LED notification profile actually has three contexts: Gmail notification, %Sleepmode doesn’t match on, and Outside profile not active. That means that the LED notification is only active when I’m not outside, and it’s not active when I sleep. This prevents me from – pardon the expression – flashing random people on the street, and it prevents me from waking up because the supernova that is that camera LED suddenly lit up the entire room for half a second. Similar uses would be to have it deactivated while in the car, only have it active in the office, and so on.
Download: Google Play