How to pick an app on Bluetooth connection?

Post your questions and help other users.

Moderators: MURTUMA, Martin

Posts: 9
Joined: 01 Jul 2015 21:18

How to pick an app on Bluetooth connection?

Postby leadhex » 02 Jan 2019 22:12

I would like a simple way to chose a Music player to launch on Bluetooth connection. If it can be hands off that would be more ideal. At one point I thought I had something setup, but I can't seem to remember how to set this up.
Any samples floating around?

User avatar
Posts: 1400
Joined: 21 Jul 2017 18:50

Re: How to pick an app on Bluetooth connection?

Postby Desmanto » 03 Jan 2019 18:48

I remember have ever created the choice with input dialog. But can't find it anywhere anymore.
The trigger is Bluetooth device connected, pick your deivce. Then you can use input dialog to show the app choice and launch that.

Create a script ot map all the app name and package name. Add/change the name and package name with your music player. You can find the package name in the launch app action.
Code: Select all
app = newMapFromValues(
"Joox", "com.tencent.ibg.joox",
"PowerAmp", "com.maxmpz.audioplayer",
"Spotify", "com.spotify.music");

choice = getMapKeys(app);


Use input dialog - Single Choice Menu, and put {choice,listformat,comma} as the list values.
Put condition expression to protect the back/cancel
Code: Select all
operation == "ok";


Then use launch app and use {choice[value]} as the package name.
Index of Automagic useful thread List of my other useful posts (and others')

Posts: 9
Joined: 01 Jul 2015 21:18

Re: How to pick an app on Bluetooth connection?

Postby leadhex » 04 Jan 2019 15:09

Thanks for the code. After it ran I received the following error:
Code: Select all
Error: Could no get launch intent for package {error}.
Please define a class
Las executed: Action Launch App: {choice[value]}


For the script I put:
Code: Select all
app = newMapFromValues(
"Plex", "com.plexapp.android",
"PlayMusic", "com.google.android.music");

choice = getMapKeys(app);


Also, I'm not seeing where to insert the following:
Put condition expression to protect the back/cancel
Code: Select all
operation == "ok";

User avatar
Posts: 1400
Joined: 21 Jul 2017 18:50

Re: How to pick an app on Bluetooth connection?

Postby Desmanto » 06 Jan 2019 11:47

Oh, sorry. I don't state the exact element clearly. Here is list :

Trigger : Bluetooth device connected
Action : Script, the script above
Action : Input Dialog - Single Choice Menu, put the {choice,listformat,comma} for the list value.
Condition : Expression, operation == "ok";
Action : Launch App, use {choice[value]}
Index of Automagic useful thread List of my other useful posts (and others')

Return to User Help / Bug Reports

Who is online

Users browsing this forum: Google [Bot] and 14 guests