App menu when connecting Bluetooth device
Moderator: Martin
App menu when connecting Bluetooth device
Hi all,
Does anyone know how to get some kind of app selector screen to pop up whenever I connect my Bluetooth headphones? So far the best I can do is to start an app that allows you to select an app but even with that I have to drag down the notifications drawer...
Does anyone know how to get some kind of app selector screen to pop up whenever I connect my Bluetooth headphones? So far the best I can do is to start an app that allows you to select an app but even with that I have to drag down the notifications drawer...
Re: App menu when connecting Bluetooth device
How many apps do you need? It seems you want only certain apps in the selection choice, it is better to use map values contains the app name and package name for selection. From this keys, use them as the choice in input dialog, then launch the app according to the selected value.
1. Trigger : Bluetooth Device Connected
2. Action : Script, create a map value, Put App name, mapped to their package name. Example :
3. Action Input dialog : Single choice menu, use the choice as the list values, {choice,listformat,comma}
4. Condition Expression : operation == "ok"
True, go to Action Launch App, false do nothing. This is to protect the launch app, so if you press back or cancel, it won't do anything.
5. Action Launch app, use {app[value]} as the package name.
BTW, do you post the thread in Flow sharing area? Because this subforum is for sharing finished flow.
But somehow it seems there is some error, that makes the thread posted in this subforum (supposed to be in User Help Subforum)
1. Trigger : Bluetooth Device Connected
2. Action : Script, create a map value, Put App name, mapped to their package name. Example :
Code: Select all
app = newMapFromValues(
"Google Music", "com.google.android.music",
"Spotify", "com.spotify.music",
"Musixmatch", "com.musixmatch.android.lyrify");
choice = getMapKeys(app);
4. Condition Expression : operation == "ok"
True, go to Action Launch App, false do nothing. This is to protect the launch app, so if you press back or cancel, it won't do anything.
5. Action Launch app, use {app[value]} as the package name.
BTW, do you post the thread in Flow sharing area? Because this subforum is for sharing finished flow.
But somehow it seems there is some error, that makes the thread posted in this subforum (supposed to be in User Help Subforum)
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: App menu when connecting Bluetooth device
Wow, that's pretty involved.
Thanks Desmanto. I've followed this as you said but after I select an app it does nothing.
Please see attached screenshot. I just copy and pasted your syntax so I don't know where I've gone wrong.
Thanks
Thanks Desmanto. I've followed this as you said but after I select an app it does nothing.
Please see attached screenshot. I just copy and pasted your syntax so I don't know where I've gone wrong.
Thanks
- Attachments
-
- Screenshot_20180201-210813.png (168.85 KiB) Viewed 28923 times
Re: App menu when connecting Bluetooth device
Also,
Regarding the forum post, that's my error - I posted in 'Flow Sharing' so I'll remember to post in the help sub next time.
Regarding the forum post, that's my error - I posted in 'Flow Sharing' so I'll remember to post in the help sub next time.
Re: App menu when connecting Bluetooth device
The culprit is the expression. It should be lower case "ok"
Automagic is heavily based on java, which is case-sensitive. Should pay attention to this small detail.
In any case something is not right, you can use condition - debug dialog, to check the value of all variables. This just remind me that I have typed a bug report including the step by step using debug dialog. I should finish it in this 2 days.
Code: Select all
operation == "ok"
In any case something is not right, you can use condition - debug dialog, to check the value of all variables. This just remind me that I have typed a bug report including the step by step using debug dialog. I should finish it in this 2 days.
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: App menu when connecting Bluetooth device
I would be grateful if you could share your completed flow for me to learn the syntax.cjt7777 wrote:Also,
Regarding the forum post, that's my error - I posted in 'Flow Sharing' so I'll remember to post in the help sub next time.
Thanks in advance.
Re: App menu when connecting Bluetooth device
Ah I see,
I was typing ok lowercase but my phone was autocorrecting it to uppercase and I didn't realize this.
Its working perfectly - I just need to customize the apps now. Thanks so much for you assistance Desmanto, this is an huge help to me!!
I was typing ok lowercase but my phone was autocorrecting it to uppercase and I didn't realize this.
Its working perfectly - I just need to customize the apps now. Thanks so much for you assistance Desmanto, this is an huge help to me!!
Re: App menu when connecting Bluetooth device
Tphg,
I've attached the flow for you, just change the bluetooth device and customize the apps (which I still need to do). I find the package names by going to where they're installed on my phone (android/data/<package name>). Maybe there's an easier way?
Enjoy!
I've attached the flow for you, just change the bluetooth device and customize the apps (which I still need to do). I find the package names by going to where they're installed on my phone (android/data/<package name>). Maybe there's an easier way?
Enjoy!
- Attachments
-
- flow_Flow2_20180202_100108.xml
- (3.23 KiB) Downloaded 1262 times
Re: App menu when connecting Bluetooth device
Hahaha, Autocorrect is toxic for scripting. But Autocomplete is fine.
To get the package name, just open the trigger and choose App Package Event. Tap the ellipsis (...) at the Package Name field, wait for the loading and pick any app you want. The result is all the choosen package name separated by comma. Copy this to and press cancel (so you won't overwrite the trigger). Back to your script, paste it and tidy it up. Put corresponding text for the key. The key doesn't have to be exactly as the app name. You can put "Start Google Music", "Start Music", or "Play Music"; as long as the package name is correct to the key you want.
It has been requested to have app picker in input dialog, but I don't think it is going to be implemented soon (since only few user need it). So far, this "App Package Event" method to get the package name is the fastest. There are other triggers can do it too, but "App Package Event" is the first one from above. (no scrolling needed). I also don't have the need to select the package name frequently. But if I do, i probably will create a flowception to utilize this "App Package Event" to select the package name.
To get the package name, just open the trigger and choose App Package Event. Tap the ellipsis (...) at the Package Name field, wait for the loading and pick any app you want. The result is all the choosen package name separated by comma. Copy this to and press cancel (so you won't overwrite the trigger). Back to your script, paste it and tidy it up. Put corresponding text for the key. The key doesn't have to be exactly as the app name. You can put "Start Google Music", "Start Music", or "Play Music"; as long as the package name is correct to the key you want.
It has been requested to have app picker in input dialog, but I don't think it is going to be implemented soon (since only few user need it). So far, this "App Package Event" method to get the package name is the fastest. There are other triggers can do it too, but "App Package Event" is the first one from above. (no scrolling needed). I also don't have the need to select the package name frequently. But if I do, i probably will create a flowception to utilize this "App Package Event" to select the package name.
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: App menu when connecting Bluetooth device
@cjt7777,cjt7777 wrote:Tphg,
I've attached the flow for you, just change the bluetooth device and customize the apps (which I still need to do). I find the package names by going to where they're installed on my phone (android/data/<package name>). Maybe there's an easier way?
Enjoy!
Thank you so much for your sharing and also thanks to Desmanto for the trick of finding the app package name.