3

My problem is that I have an intent such as this one.

Intent intent = new Intent(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);     
intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE);        
intent.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artist);     
intent.putExtra(SearchManager.QUERY, artist);
if(intent.resolveActivity(getPackageManager()) != null)
{
startActivity(intent);
}

And what happens is when I test the app it asks an open with. So if I open the standard music android app it doesn't open but when I use Google music it works like a charm.

So if there is no choice and I must use Google music as no could one answered this question I am guessing it is some problem I don't know. But atleast is there a way to set it such that it opens only via Google music app. Like setting googlw music as the default application to open the particular intent sent only by my application without harming any other process.

I am a beginner in Android. And pls. pls. Do help me.

4

1 回答 1

1

这个怎么运作。

我读过一篇关于堆栈溢出的特定文章,我不知道是哪一篇。但是,有人提到要限制您可以使用的发送意图,intent.setClass但是它需要知道活动名称和包名称。但我不知道活动名称。因此,我凭直觉尝试使用intent.setPackageBoom,它起作用了。我还要感谢 giorashc 的努力。

于 2015-08-25T15:03:50.233 回答