I have tried the most popular applications but no default shortcuts. For instance pressing the button long time could be one. I am using Samsung Galaxy 4 and Android 5.0.1.
Is there any shortcut for a better flashlight in Android?
I have tried the most popular applications but no default shortcuts. For instance pressing the button long time could be one. I am using Samsung Galaxy 4 and Android 5.0.1.
Is there any shortcut for a better flashlight in Android?
This is as far as I understood your question. You simply want to attach an action to long-press of Home key. This action, at the moment, is about activating the flashlight.
Since you can opt for root, you can also consider opting for Xposed Framework (the installer here may not work for Samsung devices running Lollipop. You would need to visit XDA forum).
Use Xposed Additions to attach an action to keys. Use TeslaLED to enable flashlight (use an alternative if this doesn't work).
Optionally, read my answer for Page up and page down in web pages and elsewhere to become familiar with the interface of Xposed Additions.
All you've to do is:
Install and enable Xposed Addtions module. Launch it.
Go to Buttons → optionally configure Long press delay → Add new Key and configure it.
Select the entry for your key → Add new Condition → Screen On → Screen On → activate Long Press → Long Press.
Replace Screen On with Screen Off, if required. Screen Off would work only for hardware buttons, such as Power button (buttons which you can actually press).
Either choose Torch or go to Shortcut → TeslaLED Toggle.
Done!
A non-root method I propose here requires AutoInput, Tasker (both are paid apps with full free 7 day trial), TeslaLED and AutoShortcut.
Setup all the apps and launch Tasker
Profile 1: Event → Plugin → AutoInput → Key → Configuration
Task for Profile 1: (Actions):
%Set
to 0
%Set
eq
0
Profile 2: Event → Plugin → AutoInput → Key → Configuration
Task for Profile 2: (Action): Variables → Variable Set: %Set
to 1
The explanation for the instructions can be found at the bottom of my answer for Prevent Accidental Reboots when holding down the power button.
As for the duration of long-press, the minimum I could satisfactorily test was one second (Wait action manages it). If your device is fast enough, you may have some good results for milliseconds. Configure Wait as per your wish.
Also, alike my other answer, the long-press for screen off would work if there involves a traditional hardware button (like Power button) which can be pressed and not simply touched.