• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Release][PX3|PX5] MtcdTools-Control music players, customize buttons, voice control

Search This thread

typos1

Senior Member
Apr 3, 2007
9,460
1,722
UK
Does this work on SC9853i units from Joying ?
What exactly do I need to make this work ?

---------- Post added at 11:18 AM ---------- Previous post was at 11:18 AM ----------

Does this work on SC9853i units from Joying ?
What exactly do I need to make this work ?

This only works on MTCD or MTCE MCU units (hence it being in the MTCD forum), so no it wont work on any Joying unit made since they stopped building MTCD units 3 or 4 years ago.
 

5TARKAN

Member
Jan 22, 2009
35
3
using "HCT4_PX5_10.0_ota(2020/06/24) MX/WITSON" ROM on my GS device, this app keeps crashing, any similar experience / suggestions?
 

AirOne70

Senior Member
Apr 10, 2012
489
309
France
Last edited:

ctrej

Senior Member
Jun 19, 2017
76
102
What about installing this version: https://forum.xda-developers.com/showpost.php?p=81153049&postcount=461 ?

Edit : I made a pull request on the official Github repo to make the app fully working again on Android 10.0 PX5. https://github.com/f1xpl/MtcdTools/pull/16

Do key bindings work for you? This is the only MTCD-Tools version I could even start, but could not get it to work:

System:
- RX6/rk3399
- Android 10/ eng.hct2.20200808
- MCU: MTCE_TONE_V3.57_1
- Root with Magisk and the installation over network ADB

On the previous installation (Android 9) the 1.9 version of this tool did work and I'm kinda bummed that it doesn't anymore. Any help or hints would be appreciated! If needed I will provide more information.
 

ctrej

Senior Member
Jun 19, 2017
76
102
Did you build the app from my pull request, using Android Studio?

Uhm no, I used the apk from your 1st link. I haven programmed anything for android yet (I work mostly with MCUs and C code), so building from the source is not that trivial for me. Could you build an apk and upload it, please?
 

AirOne70

Senior Member
Apr 10, 2012
489
309
France
Uhm no, I used the apk from your 1st link. I haven programmed anything for android yet (I work mostly with MCUs and C code), so building from the source is not that trivial for me. Could you build an apk and upload it, please?

Okay I can share my own version here, which can't be installed over an already installed MtcdTools.

Don't hesitate to give some feedback about it (correctly installed, autostart at boot, autostart after sleep, key bindings, ...).

Download attached. :fingers-crossed:
 

Attachments

  • MtcdTools-v1.10.apk
    750.1 KB · Views: 819

ctrej

Senior Member
Jun 19, 2017
76
102
Okay I can share my own version here, which can't be installed over an already installed MtcdTools.

Don't hesitate to give some feedback about it (correctly installed, autostart at boot, autostart after sleep, key bindings, ...).

Download attached. :fingers-crossed:

Just tried it real quickly, with your apk the keys are detected correctly and binding works perfectly! Now I can switch to the new radio app with the physical button :) Thank you so much! :highfive:

I have to set up a few more scripts + integration with the app "automate", that's always a bit cumbersome and I'll need a few days to get it right. I'll report back after some more in depth testing :D
 

AirOne70

Senior Member
Apr 10, 2012
489
309
France
Just tried it real quickly, with your apk the keys are detected correctly and binding works perfectly! Now I can switch to the new radio app with the physical button :) Thank you so much! :highfive:

I have to set up a few more scripts + integration with the app "automate", that's always a bit cumbersome and I'll need a few days to get it right. I'll report back after some more in depth testing :D

Nice! Thanks for your report, happy to be able to make Mtcd working again for everyone. :D
 

ctrej

Senior Member
Jun 19, 2017
76
102
Nice! Thanks for your report, happy to be able to make Mtcd working again for everyone. :D

So I've done a good part of the setup and would like to share my experience.

First the new app worked pretty well over the last few days:
- correctly installed check
- key bindings check
- autostart after sleep check
- autostart at boot: doesnt seem to work for me. I rarely shut down / reboot my unit anyway, so it's not an issue at all.

Although MTCD tools is quite flexible, it's usually quite cumbersome to map buttons to "special features" that require an intent. I stongly suggest you use automate (free for flows with <30 block or 2.99€ for full version) to receive intents and execute any action you want. Here's how to set it up:

0. Install MTCD tools and automate
1. In the car's settings, assign all buttons you want to program to unused functions. On my device * # 0 and 10+ work fine. Other numbers will open the channel in the radio app an can not be used normally. However if you use NavRadio+ (strongly recommended, it's a great improvement over stock!) you can select "favorites only" in the bottom left corner and if you have less than 9 favorites you can use those numbers as well (eg. if you have 6 favorites, then you can use 7 8 and 9 as well). You can also re-use the "radio" key if you disable the default radio app in the factory settings (in the first tab called "apps" disable the radio).
2. Open MTCD tools and create an intent for each button you need. To do that select "create a new action" > "create a new broadcast intent action". You need to fill in only two fields: The intent itself and a name, which is used within the MTCD app. I'm not sure how intents work exactly, but for automate can receive them in the format "com.llamalab.automate.mtcd.<name>" where name is user defined (letters only). The "mtcd" part is not strictly required, but is useful to show who the sender is. I've attached a screenshot for the configuration of a long press on the back button.
3. Bind each key to each action. To do that select "create a new binding", select the key name in the dropdown menu and then press "obtain key sequence". Press or hold the button to add the key-code and confirm with "save".
4. Write a automate script (called "flow") that waits for the intent. I programmed the long press on back to force close the current forground app, which is useful if an app is unresponsive or you want to restart an app. To listen to an intent, use a "broadcast receive" block and fill in the intent name into the "action" box. Leave everything else on the default value. A screenshot is attached.
5. Add more buttons. You can do this in the same flow with "fork" blocks to listen to other button presses at the same time. In this example it waits for a long press on the "navi" button, which then starts a second flow that opens the navi with the route home preselected. The flow (text file must be renamed to .flo extention) and an image of it is attached below.

Navi home route:
The automatic route back home is an extra script that currently only works for the Sygic navi, but you might be able to exted to to your favorite app. On first launch you have to specify you home adress by sharing the location from the sygic app. Just follow the on screen instructions.
Extra: If you want to port it to other apps, here's how you find out what belongs into the "open content" block. Install Nova Launcher. Open you navi app and create a "home shortcut" on your homescreen. In Nova Launcher, create a backup of your settings. Copy the file to a computer, rename it to .zip and unpack it. Open the .db file in notepad++ and search for the app package name, in my case "com.sygic.aura". Next find the "shortcut_id" filed and extract all information between the = and ; , in my case it's "com.sygic.aura%3A%2F%2Fcoordinate%7C7.00000%7C51.00000%7Cdrive%7CRoute%20Home". Convert the %xx placeholder to the right characters (look it up online) and you get "com.sygic.aura://coordinate|7.00000|51.00000|drive|Route Home". Now you only need to fill in the correct coordinates with a regular expression (regex) and you're good to go.

Automatic Hotspot:
Although not directly related to MTCD tools I want it share it with you here as well. This scripts runns on your phone and whenever it connects to your car with bluetooth, it opens up a hotspot to share its mobile data. If your parking in wifi range of your home, both devices will use your normal wifi instead. This flow also launches the syncthing-fork app from fdroid, which can synchronise any folder between phone and car. It works within the local network, so it works anywhere and doesn't consume any mobile data. Syncthing doesn't automatically start on the car, so I have written a small startup flow to fix that. It works without unlocking you phone, just get in the car, turn the ignition and within 30s or so it'll start sychonising files :) I use it to keep my music up to date without having to play over bluetooth. Note that this flow requires root to close syncthing when getting home, if you don't need that feature just remove the "kill" block. All files are attached below, as usual. Remember to edit the flo and choose the correct bluetooth device.

I had to write this quickly and wanted to get out as much information as possible, so my grammer suffered a bit, sorry for that. All code and examples are MIT licensed; just mention it and add a link to this post in the decription of any flow you share that is based on this. Thanks!
 

Attachments

  • Screenshot_mtcd_intent_automate.png
    Screenshot_mtcd_intent_automate.png
    32.4 KB · Views: 254
  • Screenshot_autpmate_intent.png
    Screenshot_autpmate_intent.png
    120.8 KB · Views: 266
  • Screenshot_MtcdKeyHandler.png
    Screenshot_MtcdKeyHandler.png
    185.3 KB · Views: 270
  • MtcdKeyHandler.txt
    248 bytes · Views: 43
  • AutoHotspot.jpg
    AutoHotspot.jpg
    140.2 KB · Views: 275
  • AutoHotspot.txt
    485 bytes · Views: 26
  • CarStartup.txt
    432 bytes · Views: 32
  • CarStartup.png
    CarStartup.png
    145.8 KB · Views: 252

AirOne70

Senior Member
Apr 10, 2012
489
309
France
So I've done a good part of the setup and would like to share my experience.

First the new app worked pretty well over the last few days:
- correctly installed check
- key bindings check
- autostart after sleep check
- autostart at boot: doesnt seem to work for me. I rarely shut down / reboot my unit anyway, so it's not an issue at all.

Thanks for your full feedback! As for your autostart at boot issue, it would be cool if you can send me your /system/framework/framework.jar file, this way I can understand what could be wrong. :fingers-crossed:

Your tutorial will be much appreciated from many I suppose, it's a great exampe of how to do whatever you want with it. I'm using a similar setup on my unit, but using MacroDroid instead of Automate.
If anyone want to know how to start MacroDroid at boot as background service (since the HU prevent apps from starting automatically at boot), you need to autorun the following service (using MtcdTools) : com.arlosoft.macrodroid.triggers.services.NotificationServiceOreo
 

ctrej

Senior Member
Jun 19, 2017
76
102
Thanks for your full feedback! As for your autostart at boot issue, it would be cool if you can send me your /system/framework/framework.jar file, this way I can understand what could be wrong. :fingers-crossed:

Your tutorial will be much appreciated from many I suppose, it's a great exampe of how to do whatever you want with it. I'm using a similar setup on my unit, but using MacroDroid instead of Automate.
If anyone want to know how to start MacroDroid at boot as background service (since the HU prevent apps from starting automatically at boot), you need to autorun the following service (using MtcdTools) : com.arlosoft.macrodroid.triggers.services.NotificationServiceOreo

So I've tested it again and for some reason launching mtcd tools after a reboot with the button works (long press on/off key) but entering hctreboot into the factory seetings menu doesn't. Again, this is not an issue for me and unless somebody else has a similiar issue you shouldn't spend your time on fixing it. It's fine as it is :)

If you still need the file, I've uploaded it (and "framework-res.apk", just in case) to my cloud storage and send you a link in a PM.
 

iavoreo

Member
Jan 28, 2021
9
0
@ctrej I have installed mtcdtools it seems to be working, also purchased navradio+,(best radio app). I am trying to map my hardware button "BAND" to start navradio+, but I am getting really lost and confused how to do it, can you assist me? How can I add button to so I can bind it to app? Is com.navimods.radio what shoud I use?
 

ctrej

Senior Member
Jun 19, 2017
76
102
@ctrej I have installed mtcdtools it seems to be working, also purchased navradio+,(best radio app). I am trying to map my hardware button "BAND" to start navradio+, but I am getting really lost and confused how to do it, can you assist me? How can I add button to so I can bind it to app? Is com.navimods.radio what shoud I use?
I'm not sure where you got stuck and honestly I'm not even sure how I solved it on my device. What I would suggest is:

1. install MCTD v1.10 (from a few posts above) and automate
2. in the factory settings, disable the original radio app and test that the "band" button does not open the original app anymore
3. use mctd to map the "band" button and create a new intend (see instructions above)
4. in automate, create a new script that listens to this ntent and launch the radio app when it receives one. see my post above for instructions. (you must select "run on boot" in the automate settings menu)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 36
    Hello,
    Today is time to release second application with more powerful features on-board. I would like to introduce MtcdTools.

    MtcdTools

    https://forum.xda-developers.com/an...ent/howto-beginners-guide-to-setting-t3595793

    21.06.2017: Version 1.9 has been released
    19.06.2017: Version 1.8 has been released
    10.05.2017: Version 1.7 has been released
    09.05.2017: Version 1.6.1 has been released
    02.03.2017: Version 1.6 has been released
    27.02.2017: Version 1.5 has been released
    23.02.2017: Version 1.4 has been released
    14.02.2017: Version 1.3.3 has been released
    13.02.2017: Version 1.3.2 has been released
    10.02.2017: Version 1.3.1 has been released
    07.02.2017: Version 1.3 has been released
    19.08.2016: Version 1.2 has been released
    14.08.2016: Version 1.1 has been released
    10.08.2016: Version 1.0 has been released

    If you enjoyed using of the application, you can support my work and Donate to me :eek:.

    Best regards,
    f1x
    9
    I rebuild the App with some changes, because the v1.9 is almost outdated. :)

    Changes:
    -Update Gradle to latest
    -Update dependencies to latest
    -Migrate Android library to latest AndroidX
    -Android 10 Support (API 29)
    -Add Day/Night support
    -Add german language
    -Add navigationbar color
    -Add one more permission
    -Fix some outdated stuff
    -Reworked Mainscreen
    -Changed statusbar + accent color
    -Reduce 50% of app size (884kb only)
    -Remove Notifications
    -Remove unneeded dependencies
    -New Launcher Icon
    -Renamed the App to MTCE Tools
    -Changed Min API from 19 to 21
    -Fixed typos
    -Removed unneeded beep sound.
    -Removed notification icons

    Screenshot + Download are Attached :)
    6
    Okay guys, we collected money needed for the PX5 board :). I ordered the board from Bob last week just to not waste the time for the shipping. According to the tracking info, the parcel is in the way to Poland :). I will start the R&D as soon as board arrives.

    The hall of fame:
    @Nomader0
    @zapedge
    @Migz93
    @bm282
    @almera020
    @SomebodySysop
    @apollo1976
    @Kalti94
    @stinger4321

    Many thanks from me and from our community, guys :). Stay tuned.
    4
    I rebuild the App with some changes, because the v1.9 is almost outdated. :)

    Changes:
    -Update Gradle to latest
    -Update dependencies to latest
    -Migrate Android library to latest AndroidX
    -Android 10 Support (API 29)
    -Add Day/Night support
    -Add german language
    -Add navigationbar color
    -Add one more permission
    -Fix some outdated stuff
    -Reworked Mainscreen
    -Changed statusbar + accent color
    -Reduce 50% of app size (884kb only)
    -Remove Notifications
    -Remove unneeded dependencies
    -New Launcher Icon
    -Renamed the App to MTCE Tools
    -Changed Min API from 19 to 21
    -Fixed typos
    -Removed unneeded beep sound.
    -Removed notification icons

    Screenshot + Download are Attached :)

    Could you please create a pull request to the original github repository?
    3
    MtcdTools 1.3 RC1

    Hello. After over one month of intensive development, it is time to release new version of MtcdTools. Version is a Release Candidate, so still few bugs or improvements are possible to find. Report them in this topic or on the GitHub page of the project. If you enjoyed - you can donate to me :).

    It is recommended to uninstall old version before installing a new one.

    Download link: https://github.com/f1xpl/MtcdTools/releases

    Below you can find a description of new features.

    Actions oriented model
    Any object which you define must have a unique name. It is used as an identifier, e.g. in voice control or action lists.​

    Actions
    Key action
    Use this action to simulate a press of android media key (e.g. play, next, pause). As of version 1.3 new media keys like REWIND and FORWARD were added. Unfortunately, most of music players do not support them, but maybe your favorite player will be able to handle it - just check.

    Supported media key events:
    KEYCODE_MEDIA_FAST_FORWARD
    KEYCODE_MEDIA_NEXT
    KEYCODE_MEDIA_PAUSE
    KEYCODE_MEDIA_PLAY
    KEYCODE_MEDIA_PLAY_PAUSE
    KEYCODE_MEDIA_PREVIOUS
    KEYCODE_MEDIA_REWIND
    KEYCODE_MEDIA_STOP​


    Launch action
    Use this action to launch an application installed on the system.​


    Start activity action
    Feature added in version 1.3. Similar feature is available in Tasker. It is useful to launch an application in a non standard way, e.g. displays specific activity accordingly to provided data URI. More information how to deal with intent are available on Android Developer site https://developer.android.com/reference/android/content/Intent.html.

    Useful intents that I discovered:

    Display your Spotify's "starred" songs:
    Intent action: android.intent.action.VIEW
    Intent Data: spotify:collection:tracks
    Intent Flags: 268435456​

    Launch Google Maps in "driving mode":
    Intent action: android.intent.action.VIEW
    Intent Data: google.navigation:/?free=1&mode=d&entry=fnls
    Intent Flags: 268435456​



    Broadcast intent action
    Feature added in version 1.3. Similar feature is available in Tasker. Use this action to broadcast an intent through the system. Some applications are using this mechanism to communicate with other apps. E.g. MTC devices are using this mechanism to notify about key press. More information how to deal with broadcast are available on Android Developer site https://developer.android.com/guide/components/broadcasts.html.​


    Actions sequences
    Feature added in version 1.3. Use it to group defined actions in sequences. Actions are stored and executed in order of addition. Useful to simulate "mode" functionality and automate playback.

    Example:
    Let's assume you defined actions "stop", "play", "my music player" and "my podcast player". Now you want to switch between your players and start playback automatically. Just declare two sequences with actions in a specific order:

    [Sequence 1]
    Stop // it should stop any active playback
    My music player // it will launch your music player
    Play // it will trigger playback of you music player launched in previous step.​

    [Sequence 2]
    Stop // it should stop any active playback
    My podcast player // it will launch your podcast player
    Play // it will trigger playback of you podcast player launched in previous step.​

    Then you can bind your action sequences with key sequence or add it to actions list and automate playback of your music players.​


    Actions list
    Feature added in version 1.3, replaces "Mode" functionality from version 1.2. Use this feature to group your actions and action sequences. You can define key sequence (I prefer to use knob) to scroll the list up and down. In settings you can set time after which highlighted item is executed. This feature is more powerful than regular "mode" because you can fully control what will be launched. You do not need to stick to the defined "mode" order and harm your devices by launching of unnecessary applications.​


    Keys sequences
    As of version 1.3 you are able to bind your defined objects (actions, action sequences, action lists) not only to single key but also to keys sequence. It means you can press any variation of hard keys (device keys and steering wheel keys) to execute your defined action.​


    Voice control
    MtcdTools 1.3 brings possibility to control your device using voice. You can say your defined actions or action sequences names and MtcdTools will execute it for you with provided order. It is possible to execute a single action or action sequence or mix them together using "concatenation word" that you can define in Settings. Concatenation is actually unlimited. You can mix actions with actions sequences and execute as many you want. Voice control is localized. Input language corresponds to the language which is set on your device. If "Google Now" supports you language, then MtcdTools will support it as well.

    To use Voice control you have to define "start activity" action with below parameters and bind it with any keys sequence:
    Class name: com.f1x.mtcdtools.activities.VoiceDispatchActivity
    Intent package: com.f1x.mtcdtools
    Flags: 813760516​

    Example:
    Let's assume you defined 2 actions called "My Music Player" and "Play". Also, you set your "concatenation word" to "then". You can say to device "My music player then play". It will trigger execution of "My music player" and "play" actions one by one.​


    Settings
    Delay of execution action from the list - define time after which highlighted item from actions list is executed.

    Voice command execution delay - define time after which MtcdTools will start processing of the provided input (actions names, etc.). A parameter has been introduced due to poor performance of our devices. It is helpful when you want to execute an playback control action ("play", "pause", etc.). "Google Now" activity will interrupt playback during speech recognition and needs some time to resume it. Sometimes it can interfere with playback control actions.

    Key press speed - define how long MtcdTools will wait to collect next key press to sequence.

    Delay of execution action from sequence - Parameter has been introduced due to poor performance of our devices. Use it to adjust time slot between the execution of actions in actions sequences or items concatenated in voice command. If you want to execute actions dependent on each other, e.g. launching of an music player and starting of a playback, you have to give some additional time to music player to be fully launched.

    Actions voice delimiter (e.g. X then Y) - Word used by MtcdTools to extract items names from provided voice input. (e.g. "my music player" <DEFINED WORD> "play").​

    Lollipop limitations
    Due to Lollipop limitations, it is possible that triggering of voice dispatch activity will bring MtcdTools application to front. To avoid this behavior, close MtcdTools using "recent" menu.​