Page 1 of 1
How to pick an app on Bluetooth connection?
Posted: 02 Jan 2019 21:12
by leadhex
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?
Re: How to pick an app on Bluetooth connection?
Posted: 03 Jan 2019 17:48
by Desmanto
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
Then use launch app and use {app[value]} as the package name. (edited : Previously I state as {choice[value]}, which is wrong)
Re: How to pick an app on Bluetooth connection?
Posted: 04 Jan 2019 14:09
by leadhex
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
Re: How to pick an app on Bluetooth connection?
Posted: 06 Jan 2019 10:47
by Desmanto
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]}
Re: How to pick an app on Bluetooth connection?
Posted: 17 Jan 2019 11:31
by cjt7777
Re: How to pick an app on Bluetooth connection?
Posted: 17 Jan 2019 17:21
by Desmanto
@cjt7777 : Thanks, I really forgot that thread. That's why I remember ever posted it. Seems after a year, my answer still very similar
The only thing is I made mistake about the {choice[value]}, which I probably started to use the method last year.