Is there any way to start playing a song in Google music player app from my app? I am trying following code, but google music player only opens the search results & does not actually play the song.
Intent intent = new Intent();
intent.setAction(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);
intent.putExtra(SearchManager.QUERY, "It's my life");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setPackage("com.google.android.music");
activity.startActivity(intent);
The documentation for INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH says following - An intent to perform a search for music media and automatically play content from the result when possible.
So, according to documentation, it should be able to play the song. But, it only opens the search results and does not play it. Any ideas what I am missing here?
Thanks for any help you can offer.