I know that long-pressing power + volume down hardware buttons for a second or so on any screen takes a screenshot - I was hoping to bind an action to the power + volume up combination (specifically I was hoping to make it take a photo without having to open the camera app).

I've looked at a few apps that I thought might do it but they all seem to only allow for remapping of individual hardware buttons/long-presses of individual buttons, not assigning an action to a hardware key combination like this.

I'm currently using cyanogenmod 11 with xposed installed, so an answer requiring either or both would work (although I didn't see any options in cyanogen or modules in xposed that would do this).


1 Answer 1


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. Media → Take Photo → customize it as per your needs.
    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!


    • 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.
    • Let the Tasker capture the image using the settings provided in that action.
    • 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.


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.

  • Note that AutoInput is available only for Android 4.3 and above
    – Firelord
    Commented Sep 14, 2015 at 0:23
  • 1
    Given the amount of time between between my original post and this response I suspect this is as close to the original goal as is possible at the moment. Sadly my power button is broken at the moment (and I've already got long press actions for the volume buttons) but I'll give this a go once it's fixed, thanks :)
    – Blair
    Commented Sep 15, 2015 at 15:15

You must log in to answer this question.

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