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?
How to pick an app on Bluetooth connection?
Moderator: Martin
Re: How to pick an app on Bluetooth connection?
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.
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)
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);
Put condition expression to protect the back/cancel
Code: Select all
operation == "ok";
Last edited by Desmanto on 17 Jan 2019 17:18, edited 1 time in total.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: How to pick an app on Bluetooth connection?
Thanks for the code. After it ran I received the following error:
For the script I put:
Also, I'm not seeing where to insert the following:
Code: Select all
Error: Could no get launch intent for package {error}.
Please define a class
Las executed: Action Launch App: {choice[value]}
Code: Select all
app = newMapFromValues(
"Plex", "com.plexapp.android",
"PlayMusic", "com.google.android.music");
choice = getMapKeys(app);
Put condition expression to protect the back/cancelCode: Select all
operation == "ok";
Re: How to pick an app on Bluetooth connection?
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]}
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 17:18, edited 1 time in total.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: How to pick an app on Bluetooth connection?
@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.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.