How to pick an app on Bluetooth connection?

Post your questions and help other users.

Moderators: MURTUMA, Martin

Posts: 10
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: 1606
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 {app[value]} as the package name. (edited : Previously I state as {choice[value]}, which is wrong)
Last edited by Desmanto on 17 Jan 2019 18:18, edited 1 time in total.
Index of Automagic useful thread List of my other useful posts (and others')

Posts: 10
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: 1606
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 {app[value]}
Last edited by Desmanto on 17 Jan 2019 18:18, edited 1 time in total.
Index of Automagic useful thread List of my other useful posts (and others')

Posts: 17
Joined: 09 Aug 2016 13:50

Re: How to pick an app on Bluetooth connection?

Postby cjt7777 » 17 Jan 2019 12:31

Desmanto helped me with this here:

viewtopic.php?f=3&t=7230

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

Re: How to pick an app on Bluetooth connection?

Postby Desmanto » 17 Jan 2019 18:21

@cjt7777 : Thanks, I really forgot that thread. That's why I remember ever posted it. Seems after a year, my answer still very similar :lol: The only thing is I made mistake about the {choice[value]}, which I probably started to use the method last year.
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 17 guests