5

I have Samsung Galaxy S4 GT-i9500 running the latest firmware with Android 4.3.

I want to create "hardware shortcuts".

For example, if I hold volume up and home at the same time, then it'll open an application that I set, for example "Firefox".

As a Linux user, I know it's possible in Fedora and Ubuntu.

Is it possible with Android? My device has not been rooted.

0

From the description, it seems like Button Savior Non Root can do this (and Button Savior (Root) even more). I didn't try it, and the description is slightly unclear whether it only emulates hardware keys using a floating menu, or you can re-map hardware keys; so your feedback is welcome if you try it.

Alternatively, the XDA developers offer an app called ButtonRemapper. While this explicitly states Tool to remap the hardware buttons, it requires root.

Last partly alternative I can name is . Here I know for sure you can remap at least the camera button. Not sure about others.

  • Button Savior can only emulate hardware buttons by creating a kind of auto hide dock on the right side of the screen from where you can select a function like phone, camera, etc. – Andris Dec 9 '13 at 22:46
  • With Tasker I found that you can only reconfigure the Camera key. You can not bind actions to combinations like Volume Up+Home. – Andris Dec 9 '13 at 22:48
  • With ButtonRemapper (ROOT) you can redefine what the hardware buttons do but you still can't configure button combinations like the OP asked. – Andris Dec 9 '13 at 22:59
  • Ah – thanks for the feedback. Wasn't sure about Button Saviour (note to self: remember). As for Tasker: OK, so that didn't change. I had hoped it was added meanwhile, as often requested. Not specifically for combos, but at least for "more keys". That leaves only the "root needed" variant of ButtonRemapper – unless someone comes up with a way to "capture the key events" in another way. // I took the combination just as an example; but you may be right with that. I still will leave my answer, might be useful for others at least (I hope). – Izzy Dec 9 '13 at 23:00
  • I too feel that Tasker should provide more key options but we can come close using AutoInput now. I came very close if not emulated perfectly here: How to create a hardware shortcuts in Android 4.3? :D – Firelord Sep 14 '15 at 21:46
0

You could try HomeSmack or Home2 Shortcut. These apps can remap the functionality of the home button to any app. With the second you can also set up combinations like Home key followed by Search key, Back key, etc. to launch an app.

0

My almost exact answer was originally posted for the question Bind action to hardware key combination.


I've come close but I still can't launch an action at the same time when two keys are pressed in combination like the way we do for taking a screenshot. Anyhow, you would need:

  • AutoInput (for Android 4.3 and above) with Tasker, both are/have paid/7-day full trial, or
  • Xposed Additions (needs root access) with Tasker to make key combination(s).

The inconvenience in this solution is that unlike pressing both keys at the same time you would have to do it in sequence. That is, press/hold Vol Up followed by Power button. The timing between these key-presses is flexible.

Single key-press

Use AutoInput with Tasker if you want to launch your action with single key presses combination i.e. only press a key one time but don't want to long-press the keys.

  1. In Tasker create an Event based profile from Plugin → AutoInput → Key → Configuration:

    • Keys: Volume Up
    • Key Action: Key Down
  2. Create a task in it named "AutoInput Volume Up" and create following actions in it:

    1. Variable → Variable Set:

      • Name: %Kset
      • To: 1
    2. Task → Wait → Seconds: 1
    3. Variable → Variable Set:

      • Name: %Kset
      • To: 0

    Explanation: When the single Vol Up press is detected the custom variable %Kset would be initialized to a custom value 1 and then we would wait for one second (under this one second you would've to press the Power key). We're then initializing the variable to 0 because our solution demands it, otherwise, our main task of capturing a photo would be executed just by a single press of Power key.

  3. Repeat step 1 but select Power key instead of Volume Up key.
  4. Create a task in it named "AutoInput Power" and create following actions in it:

    1. Task → If → Condition: %Kset eq 1
    2. Plugin → AutoInput → Modes:

      • Configuration:

        • Key Suppress: Enable
        • Keys: Power
      • Timeout: None
    3. Optional action -- Alert → Flash → Text: Commencing launch
    4. App → Launch App → Firefox**.
    5. Repeat sub-step 2 of step 4 but do Key Suppress: Disable.
    6. Optional action -- Task → Else.
    7. Optional action -- Alert → Flash → Text: Psst: You're too late Jim!


    Explanation:

    • In our first action we are checking whether the variable %Kset is set to 1 and if yes then the second action would block Power button press from getting passed to system since normally Power key-press would put the device to sleep and lock the screen.
    • Optionally flash a custom toast signalling that combination was successful.
    • Tasker would launch the Firefox or the chosen app successfully.
    • Disable Power key suppress since otherwise, you would never be able to use that button normally, as long as key suppress is not explicitly disabled or AutoInput's accessibility is running.
    • Else statement is optional but could come handy since in the beginning your consecutive key-presses may not be in coordination so the custom toast in next action would hint you that the combination wasn't successful.

That's it. Go to Home screen or to any non-Tasker app, press the Vol Up key and then the Power key under a time period of one second (don't worry, you would get a hang of it, or else, change the wait period) and you would see Tasker opening its custom interface, a picture would be captured automatically and you would be taken back to what you're originally doing.

Hurray!


Long key-press

Some people may not like single pressing both the keys since they are not habitual or may feel odd to use them in that coordination. In that case, provided that you've root access and Xposed Framework installed, you can use Xposed Additions to set long key-press actions for your keys.

For custom action to be set to those keys we would need Tasker. Create the two tasks named "AutoInput Volume Up" and "AutoInput Power" explicitly in Tasker, only if you didn't follow Single key-press section.

  1. In that app go to Button → set Long press delay time → Add new key → tap Vol Up key → select the new key entry.
  2. Tap Add new ConditionScreen On → → select the new entry → check Long Press and tap on that entry → scroll down to ShortcutTask ShortcutAutoInput Volume Up.
  3. Repeat step 1 but do it for Power key.
  4. Repeat step 2 but select AutoInput Power under Task Shortcut.

Whenever Xposed Additions is enabled and activated in Xposed Framework, on any long-press of a button/key set under that app, you would feel a slight vibration. That vibration would help immensely to know when to release the first key and long-press the other key.

Try it because it's fun.

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.