Search This thread

NarkosNakan

New member
Jun 18, 2022
4
0
Connect the output of the "Log await" with the "Toast show" node, and the output of that back into the "Log await". That will create a little message popup with the keycode everytime you press a button.
I thought I read that right in a prior post, but what buttons activate the notice? I move around and press enter on the remote but i dont see anything popping up.

Does this mean i am unable to use the flow program?
 
Last edited:

GabbyWC

Senior Member
Dec 8, 2013
486
184
Ontario, Canada
Redmi Note 9 Pro
Thanks for sharing this guide. What if I want to remap a button so that it functions with a play / pause command or the menu command when pressed instead of opening an app? Is that possible and if so, how?
 

Double_A_92

Member
May 15, 2021
26
34
LG Optimus 2x
Huawei P20 Lite
  • Like
Reactions: GabbyWC

GabbyWC

Senior Member
Dec 8, 2013
486
184
Ontario, Canada
Redmi Note 9 Pro
Maybe you could use Key send with the correct key code (see here) or Audio player control instead of the logic block that opens an app.

Alright. Does this flow look correct to you? I'm unsure as to whether or not the red "NO" circle at the bottom-right needs to be connected somewhere. I plan to use this with my Xiaomi TV Stick 4K to remap the remote's "PatchWall" button to media play/pause.
 

Attachments

  • Screenshot_20220717-210808_Automate.png
    Screenshot_20220717-210808_Automate.png
    191.3 KB · Views: 76
  • IMG_20220717_211446.jpg
    IMG_20220717_211446.jpg
    45.1 KB · Views: 76
Last edited:

Double_A_92

Member
May 15, 2021
26
34
LG Optimus 2x
Huawei P20 Lite
Alright. Does this flow look correct to you? I'm unsure as to whether or not the red "NO" circle at the bottom-right needs to be connected somewhere. I plan to use this with my Xiaomi TV Stick 4K to remap the remote's "PatchWall" button to media play/pause.
Looks correct. The "no" output must be connected like that because it needs to restart the button checking even if it was not the correct button that got pressed.

Don't know if the numbers are correct though.
 
  • Like
Reactions: GabbyWC

GabbyWC

Senior Member
Dec 8, 2013
486
184
Ontario, Canada
Redmi Note 9 Pro
Looks correct. The "no" output must be connected like that because it needs to restart the button checking even if it was not the correct button that got pressed.

Don't know if the numbers are correct though.

I've updated the flow to make it as you described. If you can confirm that it looks ready to use now, that would be great. As for the PatchWall button key code of 192, I got it from the post at https://redd.it/uo1m4s so it should be correct. The key send 0x55 command is what Automate assigns to the media play/pause function.
 

Attachments

  • Screenshot_20220718-201548_Automate.png
    Screenshot_20220718-201548_Automate.png
    187 KB · Views: 30
Last edited:
  • Like
Reactions: Double_A_92

GabbyWC

Senior Member
Dec 8, 2013
486
184
Ontario, Canada
Redmi Note 9 Pro
After plenty of testing, I'm disappointed to say that Xiaomi's PatchWall button does not function at all for me. The key code of 192 is correct (according to the toast message) but the operating system seems to have disabled the button and its ability to be remapped because I don't live in a country where the PatchWall app is supported. This must have been implemented with the current system software because the button at least did something when I set up the device a couple of weeks ago. I suspect that if any other North American users of the Xiaomi TV Stick 4K give this button a try, they will experience the same results.
 
Last edited:

Double_A_92

Member
May 15, 2021
26
34
LG Optimus 2x
Huawei P20 Lite
After plenty of testing, I'm disappointed to say that Xiaomi's PatchWall button does not function at all for me. The key code of 192 is correct (according to the toast message) but the operating system seems to have disabled the button and its ability to be remapped because I don't live in a country where the PatchWall app is supported. This must have been implemented with the current system software because the button at least did something when I set up the device a couple of weeks ago. I suspect that if any other North American users of the Xiaomi TV Stick 4K give this button a try, they will experience the same results.
If the toast message shows the key, this tutorial should still work. I.e. if you were able to show the toast, you should also be able to start some other action at that point.

It's specifically for those hard-wired keys that can't be remapped by normal means...
 

GabbyWC

Senior Member
Dec 8, 2013
486
184
Ontario, Canada
Redmi Note 9 Pro
Hmmm, I'm not sure what to make of this. I edited the flow file multiple times with key send commands such as media play/pause and menu but none of those worked when I tried them. 🤷🏻 The fact that the PatchWall button literally does not open the app it's intended for (even when the app is enabled) makes me think that Xiaomi has made this rather difficult. I'll do some more testing later today.
 
Last edited:

GabbyWC

Senior Member
Dec 8, 2013
486
184
Ontario, Canada
Redmi Note 9 Pro
I decided to purchase tvQuickActions on Google Play today and that turned out to be a great choice. That app is able to remap my remote's buttons with ease and has plenty of versatility and customizability such as different functions for double presses and long presses. It's definitely easier to use than Automate. The video below shows how I was able to remap the PatchWall button.

 
Last edited:

albdom

New member
Jun 17, 2016
1
0
Hello everyone!

I intend to remap the Netflix and Prime Video buttons on my Android TV Strong LEAP-S1 device. I have followed this tutorial because the Button Mapper App does not detect them for me. However when I run the flow in the Automate app it doesn't detect anything (flow commented above to visualize the code sent by the remote control).

Has anyone been able to test this device?
 

FlT4ever

New member
Aug 22, 2022
4
0
Hello everyone!

I intend to remap the Netflix and Prime Video buttons on my Android TV Strong LEAP-S1 device. I have followed this tutorial because the Button Mapper App does not detect them for me. However when I run the flow in the Automate app it doesn't detect anything (flow commented above to visualize the code sent by the remote control).

Has anyone been able to test this device?

Same boat, anyone?
 

RamTheMan

New member
Nov 8, 2006
4
1
Munich
Hello everyone!

I intend to remap the Netflix and Prime Video buttons on my Android TV Strong LEAP-S1 device. I have followed this tutorial because the Button Mapper App does not detect them for me. However when I run the flow in the Automate app it doesn't detect anything (flow commented above to visualize the code sent by the remote control).

Has anyone been able to test this device?
Followed ALL instructions within the video (plus prior the one not in the video but after installing the app (like overlay etc.)). Works perfect on Strong Leap S1
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    Remapping Android TV remote buttons
    In this guide I will explain a way to remap to the shortcut buttons on the remotes of Android TV devices which cannot simply be remapped by e.g. Button Mapper.
    I will use the Walmart Onn Box as example for this guide, but it should also work for devices like the Xiaomi Mi Box.

    The general idea is to install an Android automation app which analyzes the system logs of you device and starts your desired apps when it sees the button press log messages.


    Enabling ADB
    To install the automation app and give it permissions it needs, you must enable developper mode on your Android TV device and connect to it from your computer.
    Those two turorials should explain you how to do it:

    Easy way to control your Android TV device
    Since it is very cumbersome or impossible to do everything with the remote control I recommend to use ScrCpy.
    This allows you to easily control your device from your computer using mouse and keyboard.

    After installation you can connect to your device with adb and enter 'scrcpy' in your console. You should instantly see the screen of your TV on your computer.


    Installing 'Automate'
    The app I recommend for the automation is called 'Automate'. It is free, but sadly can't be directly installed from the app store on Android TV (because of compatibility).

    To avoid this limitation you can download the APK from e.g. Apkmirror and install it manually via ADB.
    adb install .\path\to\the\downloaded\apk\Automate_v1.32.6.apk

    While you are at it you can also give the app some privileges which it needs later to read the system logs and to start the apps.

    adb shell pm grant com.llamalab.automate android.permission.SYSTEM_ALERT_WINDOW
    adb shell pm grant com.llamalab.automate android.permission.READ_LOGS

    To start Automate you need a launcher that can see sideloaded apps. I recommend the X-plore File Manager since it's also a good file manager and can be easily installed from the app store.

    ( There are also other alternatives like 'Tasker' instead of 'Automate', but since that is not free and activation doesn't work properly on a sideloaded app I can't recommend that. )


    Configuring 'Automate'
    After starting Automate you can create a new 'flow'. The goal of that flow is to monitor the system logs, and start your desired apps everytime it sees a button press message.

    That can be done mainly with a 'Log await' node that contains following configuration:
    Tag: WindowManager
    Message: .*interceptKeyTq keycode=(\d+).*
    Priority: Debug
    Logged message (array): keycode

    You can then use "Expression true?" nodes to check for the found value in keycode (e.g. for the Live TV button) ...
    Formula: =keycode[1] = "172"
    ... and start your desired app with "App start" nodes.
    Package: com.google.android.tv

    An example of a full flow can be found here: 📺🎛️ Remap Onn. Android TV remote buttons


    Conclusion
    After setting all this up the apps should start when you press the buttons.
    However the original app (or its installation view) also starts before it, so if you press the back button you will return to that app instead of the previously running app. To avoid that just use the home button instead.

    The Automate app will not automatically start if you reboot your Android TV device. If you want that you can activate that in the settings: 'Run on system startup'. But make sure that everything works perfectly before you do that!

    If you get stuck in a loop where you can't use other apps and also can't open and configure Automate anymore, you can use this command via ADB to disable all flows:
    adb shell am broadcast -a com.llamalab.automate.intent.action.STOP_FLOW -n com.llamalab.automate/.StartServiceReceiver
    2
    To start Automate you need a launcher that can see sideloaded apps.

    As a one-off, in case you don't want to install another app, you can always run:

    Code:
    adb shell am start -n com.llamalab.automate/.FlowListActivity
    2
    As a one-off, in case you don't want to install another app, you can always run:

    Code:
    adb shell am start -n com.llamalab.automate/.FlowListActivity

    I went to Settings > Apps > See all apps and then scrolled down and clicked 'Show system apps'. You can find Automate, and then click open to launch.
    2
    Thanks for your guide. Now my Xiaomi Stick 4K remotes Netflix, Prime Video and Patchwall buttons are changed to open other apps.

    Can you make Automate flow work like Button Mapper having also double click and long press open different apps.
    2
    i need a rom for stick onn fullhd
    can you help me bro
    thank you so much

    Help me ( s805y ) cpu - atv 9
    Stop spamming my thread with unrelated questions. You already asked in the correct thread (here). Just wait or read the old posts, this it not a chat.