[APP] Button Mapper - Customize your hardware buttons

Search This thread

flar2

Recognized Developer
Jun 11, 2012
18,897
87,868
Southwestern Ontario
elementalx.org
I developped a small app which locks the screen, then terminates itself. Then inside ButtonMapper, I mapped the button to launch my app and everything is working fine now: no more flickering!
Just out of curiosity, I am wondering what is the method you use to lock the screen ? input keyevent 26?
EDIT: I used GLOBAL_ACTION_LOCK_SCREEN but still noticed some flickering. However, putting the call inside a post delayed handler (delay = 35 ms) solved the issue.
I use several screen off methods depending on device, Android version and options. But I should be able to add a small delay in a future update, thanks.
 

lukeoverhere

Member
Feb 17, 2015
16
0
Don't need root. The intents are actions, and you will also need to specify the package name, which is flar2.homebutton
@flar2 Thank you, though am sorry am super-newb - can you tell me what to write in the 'Intent to Broadcast' to start/stop the Button Mapper service at will?

ACTION:
PACKAGE:
COMPONENT:
DATA:
KEY:VALUE:
KEY:VALUE:

(have tried action: flar2.homebutton.PAUSE_REMAPPING, flar2.homebutton.RESUME_REMAPPING, with package flar2.homebutton, and also separately & simultaneously key:values flar2.homebutton.PAUSE_REMAPPING, flar2.homebutton.RESUME_REMAPPING)

Please let me know.
 
Last edited:

bojan.1995

Senior Member
Aug 31, 2013
146
10
The update revoked your permissions
Screenshot_20210424-101416.png


I have the permission,
when I press the button here, nothing happens.
 
Unfortunately most devices do not ship with curl and the binary is too big (and GPL) to ship with the app, so I recreate it in java. I'm not much expert in http, so not sure what the answer is
oh. so does the http get function even really work then? i mean if it can't be tested by you as you don't understand it. are you interested in looking further into this? I am more than happy to help if it means that my (literal only) usecase is addressed.
can i do what i'm trying to do via any other method?
 
Last edited:

flar2

Recognized Developer
Jun 11, 2012
18,897
87,868
Southwestern Ontario
elementalx.org
oh. so does the http get function even really work then? i mean if it can't be tested by you as you don't understand it. are you interested in looking further into this? I am more than happy to help if it means that my (literal only) usecase is addressed.
can i do what i'm trying to do via any other method?
It definitely works, others are using it to control various A/V equipment. You just have to construct the url properly, which is something I really don't know much about, and will be specific to your devices.
 
It definitely works, others are using it to control various A/V equipment. You just have to construct the url properly, which is something I really don't know much about, and will be specific to your devices.
well, as i say, I have the url correct as it works in a normal browser. Its just doesn't work in button mapper. and i'm *assuming* that it is because it is using https and a non valid (self signed) certificate.
 

Blizzard22

Senior Member
Jun 7, 2010
451
75
Redmi Note 10 Pro
Recently upgraded to the Note 10 pro (stock Rom, no root) and followed the ADB solution for screen off actions (enabled both ADB and Xiaomi specific permissions in ADB too) but it seems to not work correctly.

It works as long as I have the phone connected to the pc but as soon as I unplug the phone screen off does not work and is disabled again in the options.
I tried to re-enable it a couple of times and make sure all permissions are enabled but it does not seem to fix it.
 
Last edited:

murcianista

Senior Member
Nov 13, 2013
51
7
OnePlus 9 Pro
I use several screen off methods depending on device, Android version and options. But I should be able to add a small delay in a future update, thanks.
Hi there! Im using this App for many years, but now i have a problem, currently Im using a Xiaomi Mi 10 (MIUI 12.5, Android 11), and i have the following issue with the screen off:

when I switch on the long press option to skip tracks with the volume buttons, it works properly (with the screen off and on), but then i cant use the single press to control the volume as always I could do it, everything works fine when the screen is on but not when is off.

How can I fix it? i want with the screen off and on, be able to skip tracks using the long press and be able to control the volume of the music with the screen off and on as well.

My device is rooted, thanks very much for any help from anyone!!!


Edit:

i think i have found the solution, changing the permissions from the App.
 
Last edited:

Julianjc84

New member
Apr 29, 2021
1
0
Hi, I am trying to remap volume up in the google camera, under video recording, I want the volume up button to toggle the pause and resume button that is onscreen.

I have disable Bypass Camera to allow the app to work in camera.

I am struggling with binding volume up to a onscreen button inside aps.

Any help appreciated thank you

SOLVED. apparently there are lots of apps on play store that supports screen gestures and screen tapping without root. was just a matter of finding a app that allowed binding to a hardware button.
Mod Edit: link removed
 
Last edited by a moderator:

marciozomb13

Senior Member
Apr 30, 2012
1,560
2,989
Rio de Janeiro
Samsung Galaxy A51
Hi, I am trying to remap volume up in the google camera, under video recording, I want the volume up button to toggle the pause and resume button that is onscreen.

I have disable Bypass Camera to allow the app to work in camera.

I am struggling with binding volume up to a onscreen button inside aps.

Any help appreciated thank you
You can't remap on screen buttons.
 
  • Like
Reactions: flar2

Johnnyriko

Member
Mar 17, 2015
12
0
I'm struggling with my Philips The One Android TV to access "Frequent Settings" with one button.

Usually, I have to press "Quick Settings" button, then "Frequent Settings" sub-menu, but is there a way to map it directly to one button ? thx
 

lukeoverhere

Member
Feb 17, 2015
16
0
@flar2 - should i enter anything else here to have a button mapped to start/stop the Button Mapper with intents?

ACTION: -
PACKAGE: flar2.homebutton
COMPONENT: -
DATA: -
KEY:VALUE: flar2.homebutton.PAUSE_REMAPPING
KEY:VALUE: flar2.homebutton.RESUME_REMAPPING

*check 'start as activity?
*and does it change if I'm intending to use a button other than home?
 

u777

Member
Jan 11, 2021
6
3
The assistant button item in the button mapper app disappeared today suddenly. I don't know the reason. Why did it disappear? The assistant button item does not appear anymore when any version of the button mapper is installed, so I can"t remap the assistant button. How can I recover the assistant button item in the button mapper?
buttonmapper-assistant-jpg.jpg
buttonmapper-jpg.jpg
 

RemcoNL

New member
Jun 10, 2021
1
0
Hi, using BM Pro on Pixel 4a with all the latest updates.
When using VolumeDown key for Scroll Down it either does'nt respond at all or scrolls down just a tiny bit.
I would really like an actual Page Down / Swipe down action to occur without having to use Tasker/AutoApps.
Apps i would like to scroll in are various. Google feed, Newspaper app, Gmail, website in Chrome, ...

>> Is it possible to actually scroll down a whole page (screen height)?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    The desired behavior could

    The desired long press to skip can be achieved by macrodroid without any issue. Maybe you could look into it 😉 thanks


    Button Mapper does in fact offer complete remapping while the screen is off, I just disabled it on certain Samsung devices because the button presses are only detected while music is playing and not while the phone is in deep sleep. This was confusing to users, as skipping tracks is only one of many possible actions, leading to negative reviews, so I dropped it. On non-Samsung devices you can do anything with the screen off, even in deep sleep, and Button Mapper is the only app out there that can do that. I added those dedicated skip track options as a convenience using another very simple method. I could technically expand them to handle long press too, but it would just add a lot of complexity. I mean I could just keep adding stuff until Button Mapper is essentially Tasker, but then Button Mapper would no longer be the simple and light app that has been successful.
  • 148
    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.




    .
    32
    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