Announcements

Help Wizard

Step 1

NEXT STEP

Start shuffled Playlist with Android-Intent

Start shuffled Playlist with Android-Intent

Dear community,

 

I’m searching for a way to start a specific playlist from an Android-Intent in shuffled mode. I found out that I can start a specific playlist with the following Intent.

 

 

Event: Android.intent.action.VIEW
Data&colon; spotify:user:<playlist_owner>:playlist:<playlist-id>:play

But how can I turn on shuffle (Broadcast-Intent) or start with a shuffled option (replace or extend :play) ?

 

Background: If I connect my smartphone with my car via Bluetooth (automatically), it should play a car playlist shuffled. I don’t want to take my smartphone out of my pocket while I’m driving.

 

Thanks and best regards,

recn

Reply
15 Replies

I don't think it's possible, have you tried using an intent listener to try and capture the intent used?

If you know what you are doing you can see the Spotify public API's here: https://developer.spotify.com/technologies/spotify-android-sdk/android-sdk-api-reference/

Please use the search feature before posting a problem/bug/idea.
What's a Spotify Rock Star, and how do I become one?
     Using Spotify Since March 10th 2009
     Twitter: @mechanimal82

Android Troubleshooting:
[COMPLETE GUIDE] How to fix most Android issues
Spotify Android Version History

Googling around I found these workarounds:

 

Tasker: 

Intent: android.intent.action.VIEW

Data&colon; spotify:{username}:playlist:{PlayList URI}

THEN - Use AutoInput do one of two things:

  1. Press Shuffle Play but simply specifying Click the Text "Shuffle Play" and this will begin to play the playlist in shuffle mode.

  2. Or - begin playing the entire playlist from the beginning by using AI to click the following info Type: ListValue: 3 Action: Click

However both methods require the screen to be ON to operate.

 

non-Tasker solution that seems to work fine.

It's an app called Bluetooth Connect and Play:

https://play.google.com/store/apps/details?id=com.cp2.start.and.play.music.player

Thank you for your replies.

 

AutoInput is not an option for me, the screen is turned off and locked.

Bluetooth Connect and Play” only starts Spotify and send a play broadcast. But if there is no last playlist (default), there is nothing played.

 

The Android SDK is not for controlling the Spotify app (correct me if I’m wrong). Also I didn’t find an option to use “Spotify Connect”. And I didn’t find an API/doc for the Spotify app that shows RPC or broadcast possibilities.

But you can create your own Player-Instance with the Android SDK, start a playlist and turn on shuffle. This works fine at home. But you can only stream the music which is not an option for me due to mobile traffic limitation and bad network.

 

Maybe broadcast/call a shuffleplay is a feature request?

 

Best regards

recn

 

 

Have you checked to see if that Idea already exists in the Ideas section? If it does then add your Kudos to show your support. If not, create a new idea and if it gets enough Kudos it may well happen!


Please use the search feature before posting a problem/bug/idea.
What's a Spotify Rock Star, and how do I become one?
     Using Spotify Since March 10th 2009
     Twitter: @mechanimal82

Android Troubleshooting:
[COMPLETE GUIDE] How to fix most Android issues
Spotify Android Version History

Hello,

 

I did this and it seems to work:

 

1) Add an Action to Load Spotify

2) Add a Wait (just to be sure the app loads fully) - I have 3 seconds

3) Send an Intent like this: 

            Action: android.media.action.MEDIA_PLAY_FROM_SEARCH

            Cat: Default

            Data&colon; spotify:user:<USER ID>:playlist:<PLAYLIST ID>:play

            Package: com.spotify.music

            Objective: Activity

4) Add a Wait of 300ms (i use this because the step 3 always plays the first song on the playlist, even though is in shuffle play) 

5) Send another intent like this:

            Action: com.spotify.mobile.android.ui.widget.NEXT

            Package: com.spotify.music

            Objective: Broadcast Receiver

 

 

And thats All! Please let me know if it worked!!

Thanks so much for this!! Finally found a solution that worked!!

 

It's not playing shuffled but I can certainly live with that 🙂

 

Thanks again

 Hello, i tried what 1276904346 say and it works but anyone can help me to setup tasker to start a song at 35 seconds?

 

thank you!

Wenn eine Internetverbindung besteht funktioniert schritt 1),2),5) super. Nun braucht mein Autoradio etwas fürs internet und ich würd gerne vorher schon offline hören. Das geht nur indem ich die Playlist auswähle und shuffle oderso drücke.

 

Ich höre immer meine Musik von "Songs" also keiner regulären Playlist, wie komme ich da an ne ID und funktioniert die ID methode offline?

 

Oder gibts ein Intent der Songs öffnet/startet + eines das shuffle startet?

This works better than anything else I can find, but unfortunately it seems to just play the last active playlist.  It does load the right playlist, but the last active one just starts playing.  On marshmallow, does this still work properly?

there is a way to choose a special playlist (but not "songs"). Because every playlist has an ID (see link on web player or i dont know)

and you can start this playlist with an android-Intent.

 

I dont tried it, and i dont know how well it work, but try to search on google for it.

I tried this and ran into the following problem: I use spotify connect to connect to the desktop app running on my PC. When I use your solution, the playlists opens on the phone, but the next command is send to the desktop app, so it just skips a song in the active playlist on the desktop app. Is there a way to play a playlist on the device my spotify is connected to?

Same problem...

All solutions you can find have the same problem. Spotify just starts playling the last active playlist. The chosen playlist will be shown but not be played.

I can confirm what the others have been saying. The intent opens spotify with the right playlist but then it starts playing the playlist that was previously selected. Anyone managed to solve this?

Finally!!! Works perfect. Only thing I did different was....
spotify:user:<username>:songs:play

I play from all my saved songs usually.

I found a way to start a shuffled playlist of your choice when the screen is locked and/or off, no root required. You need Tasker, Autoinput and Secure Settings.

 

First check if the screen has to be turned on and launch spotify on background:

if %SCREEN eq off

     Plugin - Secure Settings - Configuration - Actions - Wake Device - Screen & Keyboard Lights on / 5 seconds

     Wait 100ms

     App - Launch App - Spotify

     Wait 500ms

end if

 

Then send the intent to open spotify playlist (this happens behind lockscreen):

System - Send Intent

     Action: android.media.action.MEDIA_PLAY_FROM_SEARCH

     Cat: Default

     Data: spotify:user:<userid>:playlist:<playlistid>

     Package: com.spotify.music

     Target: Activity

 

Directly after configure the AutoInput (run in foreground) action to shuffle play:

     Type: Text

     Value: SHUFFLE PLAY

     Action: Click

     Timeout: 1 sec

 

In the case of a discover weekly or release radar playlist use <userid> = spotify, else use your own <userid>. Both the <userid> and <playlistid> you can find by sharing a playlist and copy the link.

 

 

Suggested posts