AutoShare how to open a specific application via intent

639 views
Skip to first unread message

Ichwardort

unread,
Aug 28, 2014, 10:18:54 AM8/28/14
to joao...@googlegroups.com
Hi folks,

I'm currently trying to get a INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH action running for Spotify so that I can say 'play coldplay' via AutoVoice / AutoShare which would then open the spotify music app on my android device to play the song. Therefore I've created a new Action in AutoShare

{"name":"Spotify It","appname":"AutoShare","target":"Activity","action":"MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH","categories":[{"category":"android.intent.category.DEFAULT","name":"android.intent.category.DEFAULT"}],"hasOutput":false,"extras":[{"type":"String","name":"Query","description":"Terms to search for","key":"query"}]}

This works fine, however still requires me to pick the spotify app out of all apps which are able to handle this intent

Looking for sample code on how to properly call the Spotify Intent I found the following snippet on stackoverflow

Intent intent = new Intent(Intent.ACTION_MAIN);
intent
.setAction(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);
intent
.setComponent(new ComponentName("com.spotify.mobile.android.ui", "com.spotify.mobile.android.ui.Launcher"));
intent
.putExtra(SearchManager.QUERY, "michael jackson smooth criminal");

So what is required here is to add a Component to the Intent. I haven't seen any example till now how to use AutoShare Intents that set a Component.
Looking at the Autoshare Intent Builder I don't even think that's possible.

I tried something like that, but that didn't turn out to work.

{"name":"Spotify
It"
,"appname":"AutoShare","target":"Activity","action":"MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH","categories":[{"category":"android.intent.category.DEFAULT","name":"android.intent.category.DEFAULT"}],"hasOutput":false,"package":"com.spotify.music","class":"com.spotify.music.MainActivity","extras":[{"type":"String","name":"Query","description":"Terms
 to search for"
,"key":"query"}]}

Thanks for your support,
kr Andrew

Marta Hintz

unread,
Aug 28, 2014, 10:47:15 AM8/28/14
to joao...@googlegroups.com
Why not use tasker to select Spotify first? Then intent to play it. Do you only use spotify?

scott...@gmail.com

unread,
Aug 28, 2014, 4:47:54 PM8/28/14
to joao...@googlegroups.com
In your AutoShare action have you tried hitting "Advanced" and then tapping "Find Compatable Apps" and choosing Spotify? I don't have Spotify, but I use that intent and AugoShare and it allows me to pick PowerAmp and not ask which app to use each time.

Ichwardort

unread,
Aug 29, 2014, 3:53:10 AM8/29/14
to joao...@googlegroups.com, scott...@gmail.com
Hi Scott,

Thanks for the hint, I'll give it a try. Yesterday I saw a video on how this kind of search ('search for X in Y') can easily be done by using AutoLaunch

kr Andrew

João Dias

unread,
Sep 1, 2014, 7:15:58 AM9/1/14
to joao...@googlegroups.com
Yes, just use the "Find Compatible apps" option in the AutoShare action and that'll do it :)


On Thu, Aug 28, 2014 at 3:47 PM, Marta Hintz <lar...@gmail.com> wrote:
Why not use tasker to select Spotify first?   Then intent to play it.  Do you only use spotify?

--
You received this message because you are subscribed to the Google Groups "joaomgcd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joaomgcd+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages