[Android Head-Units] okij:
Tasker profile for easier switching of Bluetooth phones

As I wrote on this thread before, I have to use two mobile phones (one private and one job related), which is quite annoying on an Android head unit due to the following reasons:

Only one phone can be connected via Bluetooth at a time.

It's really annoying to switch the Bluetooth connection to the other phone because it needs seven (!) clicks: 1. start Bluetooth app, 2. click on the "BT Devices List" button, 3. click on the currently connected phone, 4. click on the "Disconnect" button, 5. click on the phone that should be connected, 6. click on the "Connect" button, 7. press "Home" to return to FCC Launcher.

Most of the time that I enter my car, my private phone gets automatically connected (probably because it has the lower MAC address!?) and during work time I have to perform the above mentioned click orgy to connect my job phone.

Because of this I made a Tasker profile which makes the switching of two BT phones much easier and auto-connects to my work phone during my work time. It has the following features:

Switching between two BT phones is done by just one click on the Bluetooth widget of the FCC Launcher, thanks to [MENTION=4292729]SpeedFire-[/MENTION], who at my request implemented the sending of a broadcast intent when the BT widget is clicked.

During my work time (Mondays to Thursdays 7:00 to 17:00 and Fridays to 14:00) the Tasker profile automatically switches to my job phone if my private phone gets automatically connected after I turn on my car / head unit.

I'm sharing this Tasker profile here, so other users can benefit from it too. :)

In the attachments, you find both an English and a German version of the profile, the only difference is the text of some status toast messages like "Phone xx connected". Both versions contain some comments in English to explain how some things got implemented.

For the Tasker profile you need Tasker (obviously) and the AutoInput plugin (for simulating button presses on the Bluetooth app). Unfortunately I didn't find any intents for (dis-)connecting BT devices without using the Bluetooth app or the System settings. If anyone knows some intents or other tricks, please let me know.

I'm using a PX5 MTCE head unit which runs on [MENTION=5092263]Hal9k_[/MENTION]'s Mod 4.0.1 (Android 9) ROM.

My Tasker profile should work on other MTCE devices (like PX30 and PX6) too if the Bluetooth app is the same or similar, so maybe it also works on Android 8 or lower. If it doesn't work, most likely the AutoInput parts of the profile have to be adapted to the other Bluetooth app, or maybe the Bluetooth intent that the systems sends when a device is connected or disconnected is different from com.microntek.bt.report.

After importing the Tasker profile, you have to enter the device names and MAC addresses of your phones in the Init Device Variables task, exactly as they are written in the devices list of the Bluetooth app. Device1 is the private phone, Device2 is the job phone. You have to run this task once to set the according variables in Tasker.

If you want to change the work times (i.e. the times that phone 2 is preferred), you can edit the according IF condition in the On Work Time Switch To Phone 2 If Possible task.

Please let me know if you make use of this Tasker profile or if you have any ideas for further improvement.