Did you find this article helpful?
How to launch an Android Intent to search for and play a song on the Spotify app
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm developing an application and would like to launch the Spotify app and have it search for and play a song. The following command line works with Google Play Music but not with Spotify:
adb shell am start -a "android.media.action.MEDIA_PLAY_FROM_SEARCH" -e android.intent.extra.focus "vnd.android.cursor.item/*" -e query "yellow\ submarine\ by\ the\ beatles"
Specifically, when I select "Google Play Music" from the chooser, Google Play Music opens and plays Yellow Submarine. When I select "Spotify" from the chooser, a search for Yellow Submarine, but the song is not played.
Here is how to create the above intent in code.
Intent intent = new Intent(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH); intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, "vnd.android.cursor.item/*"); intent.putExtra(SearchManager.QUERY, "yellow submarine by the beatles");
Can anyone tell me the right way to use an intent to search for and play a song in Spotify? I am a premium subscriber and logged into my account.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page