[MTCD Software Development] ctrej:
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!