How to start music playing in appropriate apps? - Android Q&A, Help & Troubleshooting

I am working on an open source voice assistant and want to be able to hand off requests like "Play 'yellow submarine' on Spotify" or "Play 'space oddity' on Google Play Music".
According to the documentation:
To play music based on a search query, use the INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH intent. An app may fire this intent in response to the user's voice command to play music. The receiving app for this intent performs a search within its inventory to match existing content to the given query and starts playing that content.
This intent should include the EXTRA_MEDIA_FOCUS string extra, which specifies the intended search mode. For example, the search mode can specify whether the search is for an artist name or song name.​
The value of INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH is "android.media.action.MEDIA_PLAY_FROM_SEARCH", and the value of EXTRA_MEDIA_FOCUS is "android.intent.extra.focus".
Here's a command line to launch an intent:
adb shell am start -a "android.media.action.MEDIA_PLAY_FROM_SEARCH" -e android.intent.extra.focus "vnd.android.cursor.item/*" -e query Bowie
When I run the command line, the chooser on my Pixel 2 running Android 10 gives me many options. Only one works as expected. If I select Google Play Music, it starts playing a song by David Bowie.
However, if I select Spotify or YouTube Music, it does a search for Bowie but does not play anything.
If I select YouTube, it just opens YouTube but doesn't do a search.
I have premium subscriptions to Spotify and YouTube, so the requests should work. When I ask the Google voice assistant "play bowie on Spotify" (or on YouTube), it plays a song by David Bowie.
How can I get my app to behave the same way as the Google voice assistant?

Related

Tweaking Samsung Voice talk command actions?

Hey All,
Is it possible to tweak the Samsung Voice Talk command actions?
For example: when I speak a voice command, such as 'Play Pink Floyd', the application will launcher the default music player and begin playing the artist specified after 'play'. Is it at all possible to configure this to open in another application?

[Q] Voice Actions - Listen to song with apostrophe

Is there a way to get Voice Actions to recognize a song with an apostrophe in the title? For example, I want to play Tuesday's Gone, but when I say it Voice Actions recognizes "listen to tuesdays gone" and it doesn't play anything. If I rename the song to Tuesdays Gone I can get it to play, but I don't want to rename all my library.
Thank you.

Google Now and local phone search

Hi,
Google Now used to be able to play music tracks from your phone.
"Listen to Adele" or "Play Adele" will display a card prompting to play it with your music player.
Recently I noticed that this no longer works. The Listen and Play command returns web results only.
Tried doing a search say "Adele", it correctly displays web results.. If you slide the bottom bar to to the left to get at Phone search, it gives no results found. Even though there is a track on the phone by Adele.
i have 2 music players, Apollo and Rocket Player.
When I go into Google Now > Settings to applications configured to be searchable, both are not listed. I have probed inside the APK of these apps. They have it enabled.
Any help?

Google music start playlist playback activity

I have been trying to make Google music play a specific playlist via Automate (similar to tasker) when my alarm goes off. But I don't know what app activity to pick. I have found the playlist shortcut but that only launches the app and shows the playlist. I want it to play it also. How do I make this work?
Thank you

Problem with voice Control for Music on Wear

Hey XDA-Developers Community!
I've got a Problem regarding the Voice Control Features for Music Playback on Android Wear.
I often use it to quickly start listening to Music of a certain Artist, by saying something like: play [artist].
But when doing this on my Moto 360 it always launches the SoundCloud app and searches for the corresponding Artist there.
However, I want this to be done with Google Play Music or the Music app provided by CM11.
When using Google Now on my Phone (LG G3 running CM11) I can choose which app should be used for Playback and it always uses my Preset.
I have "Music Playback" set to Play Music in the Android Wear Application and reset any default Actions in the app Directory of the Phone Settings.
I hope that someone maybe had the same Issue and/or knows a Way around it.
Greetings from Germany and I wish you all an awesome (hopefully sunny) Sunday!

Categories

Resources