0

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?

  • What kind of shortcut do you want? App shortcut, button shortcut or some other shortcut? Where do you want to place it? Is the device rooted? – Firelord Oct 22 '15 at 5:00
  • @Firelord Button shortcut would be nice so you can start the flashlight easy. I mean the main physical button and a long press with it, for instance. Device is not rooted but it can possibly done. – Léo Léopold Hertz 준영 Oct 22 '15 at 5:02
  • Does TeslaLED works in your device? It has an app shortcut which you can directly launch from home screen. – Firelord Oct 22 '15 at 5:06
  • 5.0.1. I am going to try it if you can have a physical button shortcut to it. – Léo Léopold Hertz 준영 Oct 22 '15 at 5:08
  • 1
    On Galaxy S4 there should be a built-in widget called Assistive light – Manubhargav Oct 22 '15 at 6:10
2

A non-root method I propose here requires AutoInput, Tasker (both are paid apps with full free 7 day trial), TeslaLED and AutoShortcut.

Instructions:

  1. Setup all the apps and launch Tasker
  2. Profile 1: Event → Plugin → AutoInput → Key → Configuration

    • Keys: Home
    • Key Action: Key Down
  3. Task for Profile 1: (Actions):

    1. Variables → Variable Set: %Set to 0
    2. Task → Wait: 1 Second
    3. Task → If: %Set eq 0
    4. Plugin → AutoShortcut → Configuration → TeslaLED Toggle
  4. Profile 2: Event → Plugin → AutoInput → Key → Configuration

    • Keys: Home
    • Key Action: Key Up
  5. 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.

  • Thank you for your answers! I hope this feature will become a feature in Android by default. – Léo Léopold Hertz 준영 Oct 22 '15 at 19:49
  • @Masi, Thank you for accepting the answer. I just want to confirm something, did you test my answer and then accept it or did you accept it simply in hurry? It's important because I need to know whether my answer works for a Samsung device or not. :) – Firelord Oct 22 '15 at 19:51
  • I accepted it because it sounds solid and concrete. I will test your answer one weekend. I will provide feedback here when I am done but I am also open for any updates. – Léo Léopold Hertz 준영 Oct 22 '15 at 19:53
2

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:

  1. Install and enable Xposed Addtions module. Launch it.
  2. Go to Buttons → optionally configure Long press delay → Add new Key and configure it.
  3. 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).

  4. Either choose Torch or go to Shortcut → TeslaLED Toggle.

Done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.