[APP] Button Mapper - Customize your hardware buttons

Search This thread

Talon

Senior Member
But it will require a rooted phone
strangely enough - but this function works on my Sony TV ...
- and now it very lacking ... - ( for closes the applications... and, most importantly, it return to the android launcher from other HDMI inputs screens - it just simply killing them :) )

and Flar please - make the 'volume panel bypass' worked on Sony TV.... - look for the posibility for normally adjust the volume on the Sony TV ... - it's hellish torture to adjust volume one by one step for each press (and in my case it twice - bcs the step is 0.5 due to CEC incompatibility with the receiver)
...
 

4umexdeeay

Senior Member
Hi there,

(Thanks very much for your efforts with this app.)

-> Just installed on Google TV (Android OS 11, build RTT2.220118.001) for the first time.

I was able to remap the Home button on the tv remote to trigger a couple of installed apps - working great 😁👍

- but haven't figured out how to trigger a specific input (example: "HDMI 1").

Is this possible?

So far I tried clicking on "+ Add Buttons", then selected the desired button on the remote, then checked out the customization options; I looked through "Actions", "Applications", "Shortcuts", "System", "Advanced", etc, and didn't notice anything that would work.

If I'm missing something, your/anyone's suggestions would be appreciated.

Thx in advance 🙂

anyone-answer.gif
 

kwyjibo2000

New member
Aug 13, 2022
2
0
I've just bought a Philips Android TV (OLED806) and would like to use Button Mapper to directly select an HDMI input source. I am able to execute the following adb command to successfully swithch to HDMI1:

Code:
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW5 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

How do I convert this into an action that can be mapped to a button? I have seen this question more on this forum but haven't seen an answer. It seems that it should somehow be converted into a Broadcast intent, but I have no idea what information to fill out where in the 'Intent to Broadcast' button mapper section. Any help on how to accomplish this (if possible) would be greatly appreciated, thanks!

Edit: my best guess is the following:
Action: android.intent.action.VIEW
Package: org.droidtv.playtv
Component: org.droidtv.playtv.PlayTvActivity
Data: content://android.media.tv/passthrough/com.mediatek.tvinput/.hdmi.HDMIInputService/HW5

This results in a black screen when pushing the button (not an actual switch to the HDMI input). Some questions I have:
- The adb command sends flag 0x10000000, where would I put that in the button mapper broadcast?
- The adb command uses the %2F escape code for forward slash in two locations, and the post where I found this command (https://community.home-assistant.io/t/android-tv-hdmi/234411/27) indicates this is important. I tried entering %2F into button mapper but it changed them into a forward slash. Could this affect the outcome?
 
Last edited:

discapacidad5

Member
Dec 25, 2016
8
0
If it's Bluetooth, it probably won't work. Not sure why, but a lot of Bluetooth devices handle button presses internally. If they are not detected by the add buttons dialog, there is no ability to remap them at all.
hello I have bluetooth headphones that have three Play buttons forward and back, the funny thing is that the buttons are recognized by the music player they are also recognized by Zello workie talkie,which by the way has an option to add custom buttons very similar to renaper and the buttons recognize it perfectly I think it would be good if they did a review,because I am sure that the buttons work well and are recognized by other applications, I think there is something that they are not doing well so that the bluetooth buttons are recognized
 

flar2

Recognized Developer
Jun 11, 2012
18,825
87,799
Southwestern Ontario
elementalx.org
hello I have bluetooth headphones that have three Play buttons forward and back, the funny thing is that the buttons are recognized by the music player they are also recognized by Zello workie talkie,which by the way has an option to add custom buttons very similar to renaper and the buttons recognize it perfectly I think it would be good if they did a review,because I am sure that the buttons work well and are recognized by other applications, I think there is something that they are not doing well so that the bluetooth buttons are recognized
That's different, those apps are responding to the media commands issued by those buttons, not suppressing the original action and doing something else. My app Next Track works like that but is very limited compared to Button Mapper.

But the main reason I can't have that in button Mapper is the remapping would only work if Button Mapper continuously played a media file or was actively recording. It would kill the battery.
 

payas0

Senior Member
I've just bought a Philips Android TV (OLED806) and would like to use Button Mapper to directly select an HDMI input source. I am able to execute the following adb command to successfully swithch to HDMI1:

Code:
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW5 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

How do I convert this into an action that can be mapped to a button? I have seen this question more on this forum but haven't seen an answer. It seems that it should somehow be converted into a Broadcast intent, but I have no idea what information to fill out where in the 'Intent to Broadcast' button mapper section. Any help on how to accomplish this (if possible) would be greatly appreciated, thanks!

Edit: my best guess is the following:
Action: android.intent.action.VIEW
Package: org.droidtv.playtv
Component: org.droidtv.playtv.PlayTvActivity
Data: content://android.media.tv/passthrough/com.mediatek.tvinput/.hdmi.HDMIInputService/HW5

This results in a black screen when pushing the button (not an actual switch to the HDMI input). Some questions I have:
- The adb command sends flag 0x10000000, where would I put that in the button mapper broadcast?
- The adb command uses the %2F escape code for forward slash in two locations, and the post where I found this command (https://community.home-assistant.io/t/android-tv-hdmi/234411/27) indicates this is important. I tried entering %2F into button mapper but it changed them into a forward slash. Could this affect the outcome?

I managed to make the Boradcast Intent for my use case and I posted about it in the last page. But I didn't need to pass an actual data/payload.

The activity in this command must be the org.droidtv.playtv/.PlayTvActivity
Can you try it like so?

Action: /.PlayTvActivity
Package: org.droidtv.playtv
Component: org.droidtv.playtv.PlayTvActivity
Data: content://android.media.tv/passthrough/com.mediatek.tvinput/.hdmi.HDMIInputService/HW5

In the action, the slash before the actual activity name is important. I'm not sure how to map the last argument (-f 0x10000000) though.

Can you try using a Root Command instead? Try this command:

am start-activity android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW5 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000
 
  • Like
Reactions: flar2

kwyjibo2000

New member
Aug 13, 2022
2
0
By Root Command do you mean using button mapper to execute that command as a shell command? I get the following error:
- toybox: Unknown command am

If I use the explicit path to am (/system/bin/am) I get a long error toast that only stays up briefly, but seems to indicate that I am not the correct user.

(from an adb shell from my laptop that command works well)

On the plus side: I have now managed to assign some other menu's to hardware buttons using broadcast intent (the ambilight menu and the sources menu), allowing me to use my much smaller Shield remote to control most of the TV. Thanks writing Button Mapper!
 
Last edited:

glumada

Member
Mar 27, 2018
19
0
I installed Android 12 today, but Button Mapper isn't working anymore.

I red here I should visit setup.buttonmapper.app, which I did, but when entering "adb shell sh /sdcard/Android/data/flar2.homebutton/logcat.sh" into adb, I get "no such file or directory".
I'm running Button Mapper 3.09 and can't find such a file in this directory with a file manager, only a "files" directory, an files named "config_1", "keycode.sh" and "keyevent.sh"

what am I doing wrong?
 

flar2

Recognized Developer
Jun 11, 2012
18,825
87,799
Southwestern Ontario
elementalx.org
I installed Android 12 today, but Button Mapper isn't working anymore.

I red here I should visit setup.buttonmapper.app, which I did, but when entering "adb shell sh /sdcard/Android/data/flar2.homebutton/logcat.sh" into adb, I get "no such file or directory".
I'm running Button Mapper 3.09 and can't find such a file in this directory with a file manager, only a "files" directory, an files named "config_1", "keycode.sh" and "keyevent.sh"

what am I doing wrong?
Go to setup.buttonmapper.com and scroll down to the bottom, there are separate instructions for Android 12.
Everything works the same, but the commands are slightly different
 

glumada

Member
Mar 27, 2018
19
0
Go to setup.buttonmapper.com and scroll down to the bottom, there are separate instructions for Android 12.
Everything works the same, but the commands are slightly different
That's what I did, except I went to setup.buttonmapper.app instead of .com because 8 can not find android12 installation instructions on the .com site

Remap Bixby, Active Edge, Assistant button or Motion Sense (one-time setup)
Android 12 ./adb shell sh /sdcard/Android/data/flar2.homebutton/logcat.sh


That's what I entered, and I get the result that no such file was found, which after looking into the directory manually is correct.
 

flar2

Recognized Developer
Jun 11, 2012
18,825
87,799
Southwestern Ontario
elementalx.org
That's what I did, except I went to setup.buttonmapper.app instead of .com because 8 can not find android12 installation instructions on the .com site

Remap Bixby, Active Edge, Assistant button or Motion Sense (one-time setup)
Android 12 ./adb shell sh /sdcard/Android/data/flar2.homebutton/logcat.sh


That's what I entered, and I get the result that no such file was found, which after looking into the directory manually is correct.
Uninstall and reinstall the app
 

flar2

Recognized Developer
Jun 11, 2012
18,825
87,799
Southwestern Ontario
elementalx.org
I did it twice because I thought something's off, but it changed nothing. No matter if I open the commandline before I start the app for the 1st time or after, with or wirhout granting root access....
Did you try to enable the option in the app before doing thebadb commands?

I don't know why it doesn't work for you, it works for everyone else
 

wols2

New member
Sep 8, 2022
1
0
After updating to Android 13, vibration on button presses (e.g. "Volume button vibration") only works when "Touch feedback" is enabled in the system settings under "Interactive haptics".

This is inconvenient because I dislike haptics for navigating and typing but would still like some feedback when Button Mapper registered my intention to do something.

Under Android 12 it worked without enabling the touch feedback.

Pixel 4a, Android 13, Button Mapper v3.09
 

andyrew924

New member
Jul 29, 2010
3
0
Trying to setup button mapper to do a sequence of key presses. Is this possible?

For example, I would like a single key press to send keycode for MENU-->ENTER-->RIGHT-->ENTER. I've tried "83,23,22,23", "83;23;22;23", "83&23&22&23", and "83 23 22 23"... none of those worked.

Since I couldn't get this to work, thought I would try just doing a shell command "input keyevent 83 && input keyevent 22...", but that didn't work. In reading through the thread, it looks like Android sandboxes shell commands, which is likely why this approach didn't work.

Is there any option to get a single key press to send a sequence of keycodes?
 

NoFatePPC

Senior Member
Mar 12, 2007
769
28
Hi, sorry if asked before, but new to button mapper, purchased pro version
I have a goodle tv, and remapped the "netflix" button to another "APP"

Now, i have HA, what would be the webhook URL to trigger that button with a POST commannd? I dont see the post url in the button mapper? what am i missing?

thnx
 

johnfre

Member
Jul 28, 2011
24
0
Owen Sound
Just purchased PRO... can I map, for example VolumeDown to LeftArrow? (shows as DPAD_LEFT(21) and DPAD_RIGHT(22) on my Rii "i4" full keyboard. I'm trying to use a ChubbyButtons 5-button bluetooth under my pillow at night to jump fwd/back in YouTube, and on long eg 18hr youtube, the ScrollUpDn goes very far eg 70-minutes instead of a nice 10-seconds that the i4 gives me, so not usable like that.
 

ragneron

New member
Sep 15, 2022
2
0
v60

Hi there, got the pro version and when i mapped volume up and assistant buttons for double pressing the activity I mapped AND the default activity occur. For example I set the double press of the assistant button to put the phone on vibrate . when I double press it puts it the phone on vibrate and it launches the default action which is to launch google assistant. The phone is an LG V60. Not rooted. Thank you
I have the exact same problem and exact same phone. Android 12, update version V600TM30c, no root. did you ever find a solution?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 142
    p2142635636.jpg



    Button Mapper allows you to remap any action you want to physical or capacitive hardware buttons. This includes volume buttons, camera button, home button on Samsung devices and capacitive home, back and recents, Bixby, Active Edge, LG assistant button and many buttons on game controllers and other hardware. It does NOT work with onscreen home, back and recents buttons (i.e. soft keys or the navigation bar).

    You can launch shortcuts, apps or actions to single press, double tap and long press for hardware buttons.





    Download on XDA Labs:
    https://labs.xda-developers.com/store/app/flar2.homebutton

    Limitations:
    -does not work when the screen is off (unless rooted)
    -only works with hardware buttons, not onscreen buttons (i.e. navigation bar)
    -power button cannot be modified
    -there can be quirks with some devices due to non-standard hardware and software implementations by various manufacturers. I try to fix them, but sometimes it's difficult if I don't have the device to test.




    .
    31
    Examples of things you can do with this app:

    -Lockscreen peek: press and hold the home button to quickly check your lockscreen messages, release to turn off the screen (requires PRO VERSION)
    -Launch an app by long pressing the home button
    -Swap the back and recents buttons (capacitive buttons only, like on Samsung Galaxy or Asus Zenfone or One Plus One)
    -Use the home button to the turn the screen off from the homescreen on your Samsung Galaxy (requires PRO VERSION)
    -Control the button lights on your Samsung Galaxy. Turn them on or off, or change the length of time they light up
    18
    Big update!


    After many weeks of work, I've released an update that adds many new features and improvements, and fixes some longstanding bugs.

    The new version is rolling out to a small number of users on the Google Play Store.
    You can download the new version now on XDA Labs.



    Download on XDA Labs:
    https://labs.xda-developers.com/store/app/flar2.homebutton

    Pixel 2 Active Edge
    The Pixel 2 battery drain was caused by remapping Active Edge with root and not enabling screen off actions. It has nothing to do with the method that I use to remap the Edge squeeze, it was caused by a typo in the options logic. There are a lot of myths about how this app handles Active Edge. First of all, it does not consume battery and does not slow down your system. Such claims are false (notwithstanding the bug, which is now fixed). The method for remapping Active Edge does not scan through every logcat message. With root, it's 100% reliable and you will never see the Assistant and will remain in your current app. Without root, you will occasionally see the Assistant and it may bring you to the homescreen. The only limitation is you need to use English language until Google enables the Assistant for other languages.

    Root Command
    You can now remap buttons to a root command. This offers unlimited possibilities for power users. Obviously this requires root! It's available in the Pro version only

    Custom Key Codes
    You can also remap buttons to custom key codes. This means you can fully remap game controllers, tv remotes and other hardware attached to your device. I've compiled a list of key codes that are recognized by Android here. This requires root, unfortunately. It's available in the Pro version only.

    MIUI
    MIUI does some really stupid things to Android. In order for Button Mapper to work correctly, you need to grant the "Autostart" permission and disable battery optimization. If you do not grant the autostart permission, swiping Button Mapper away in recents will kill the service. If you do not set battery optimization to "No restrictions", then Button Mapper's service will be killed every 10 minutes or so.

    To grant these permissions, in go to the menu at upper right in Button Mapper and select "Introduction." Swipe to the screen title Permissions and follow the instructions.

    Samsung volume bug
    I tracked down a few obscure bugs on Samsung phones, including the volume scaling bug that I could never reproduce. This occurred when the volume buttons were remapped and then later the "Bixby only" option was selected without rebooting.

    Pirating this app
    Don't install pirated versions of this app (or any app that uses Accessibility or root), even just to try for a few minutes. Because it uses Accessibility Service and root, you must fully trust the developer. Using a pirated version of any root app gives hackers carte blanche on your device.



    • New actions:
      -toggle BlueTooth
      -headset key press
      -change keyboard
      -root command (requres root and PRO)
      -custom keycodes (requires root and PRO)
    • Android TV support
    • Screen off only option (requires root and PRO)
    • Fix battery drain on rooted Pixel 2
    • Update translations
    • Fix volume change for screen off actions
    • Improve Bixby handling
    • Fix volume bug on S8/Note8
    • Improve UI
    • Add 180 rotation to swap volume orientation setting
    • Improve root handling
    • Improve MIUI behaviour
    • New intro
    • Add feedback form
    • Speed and memory optimizations
    • Many other bug fixes and improvements



    .
    15
    Button Mapper update!

    There is an awesome new update for Button Mapper rolling out. You can get it on XDA Labs now, and on the Play Store in the coming days. This update improves volume button behavior, has fixes for Android Pie, improves Bixby remapping, lots of updates for Blackberry devices and adds a bunch of new actions, such as fullscreen mode, invert colors, toggles for NFC, airplane mode and mobile data, broadcast intents, Greek and Arabic languages, plus the usual bugfixes.

    Download on XDA Labs:
    https://labs.xda-developers.com/store/app/flar2.homebutton

    I want to highlight two important new features.

    First, the broadcast intent action (pro version only!). With this action, you can use a button press to broadcast an intent, which is Android's way of communicating between apps. This opens up literally endless possibilities. For example, if you have my High Brightness Mode app installed, you could enter flar2.hbmwidget.TOGGLE_HBM for long-press of volume button to toggle high brightness mode.

    The second feature is a new option to disable volume button remapping when the volume panel is showing. For example, if you have long press volume down mapped to toggle the flashlight, when the volume panel is showing, holding down volume will turn the volume down rather than turning on the flashlight. Once the volume panel disappears, holding the volume button will once again toggle the flashlight. I think this makes the volume button behavior more intuitive, so it's enabled by default. This can be turned off if you don't like it, the option is in Advanced options->Volume panel bypass.

    Please enjoy, and don't forget to leave a positive review if you find Button Mapper useful.
    12
    Version 0.66 is now released. It will roll out slowly on the Play Store, if you want it now, get it from XDA Labs
    https://labs.xda-developers.com/store/app/flar2.homebutton

    This version has tons of small fixups: volume button behavior is vastly improved, activities open right away after pressing home, everything is faster, and there are more options. Also quite a few UI improvements. New actions include toggle mobile data (root only), toggle wifi hotspot (Nougat and lower only), toggle autobrightness and clearn notifications. There is a new option to enable pocket detection, so actions won't occur while the phone is in your pocket (requires pro version).

    For Android P users, I've fixed the volume buttons to default to media and added an option to force them to control ring volume like older versions of Android.

    There is now an option to lock the screen in a way that allows you to unlock with the fingerprint. Rooted users could always do that, now unrooted users can too.

    I've also added an option to force audio routing through the speaker while Pressy, MiKey or other headphone jack buttons are plugged in. I don't have one of these devices, but it should all work.


    Changes:
    Pocket detection (pro)
    Toggle auto brightness
    Toggle Wifi hotspot (Android 7 and lower)
    Toggle mobile data (root)
    Clear notifications
    Compatibility with Android P
    Option to use speaker with Pressy, MiKey, etc
    Global bypass option
    More long press duration options
    Receive incoming phone calls with home button (Samsung)
    Add Spanish
    Update translations
    UI improvements
    Optional lock method that allows fingerprint unlocking
    Fix AOD crash with screenshot action (Samsung)
    Optimizations and bugfixes