Tasker – Spotify Plug, Load and Play




Since the method I posted before doesn’t work on Android L 5.0 and up, I’ve edited a few steps. This fix was mentioned by Quint in the comment section. Thanks Quint!

This tutorial explains how to make your Tasker app launch Spotify when you plug in your headphones, then raise the volume and play the last played track.

What You’ll Need:
Tasker by Crafty Apps EU


We will need to setup the profile that triggers when you plug your headphones in.

• Open your Tasker application.
• Select the “Profiles” tab in the top left.
• Click the “+” icon in the bottom right.
• Click on “State“.
• Select “Hardware“.
• Select “Headset Plugged” and leave the settings as they are and press back.


Now we will setup the task (actions) that will occur when the profile is triggered.

Loading Spotify
• Press the “New Task +” that appeared.
• Let’s name it “Spotify Plug Play“.
• Click the “+” icon at the bottom to add an action.
• Select the “App” category.
• Select “Load App“. Find Spotify and select it.
• Press back.


Add a Wait action.
(This is to make sure the app is fully loaded before pressing play.)
• Click the “+” at the bottom.
• Select the “Task” category.
• Select “Wait“.
• Set Seconds to or which you prefer,


Raise the Volume
• Click the “+” icon at the bottom to add another action.
• Select the “Audio” category.
• Select “Media Volume” and set Level to your desired volume.
• Press back.


Getting Spotify to play.
• Click the “+” icon at the bottom.
• Select the “System” category.
• Select “Send Intent
• Set these fields:
Action: com.spotify.mobile.android.ui.widget.PLAY
Cat: None
Package: com.spotify.music
Target: Broadcast Reciever


If you do not have any headphones to test this with, press the play icon down to the left.


52 thoughts on “Tasker – Spotify Plug, Load and Play

  1. abcd

    Yeah, it works, thanks. I tried the input keyevent commands first to start playing, but that did not work with the screen off, this Media Utilities stuff works with the screen off.

  2. Everything appeared to configure correctly but not doing anything this end. Tried smart play too. S5. Thanks for the method though, really helped. Will have a play will more than likely be some slight update to Spotify or music utils. Cheers Marc

  3. Emil

    I use YouTube a lot and it was bugging me that it turned on spotify when I was watching YouTube. So I added an if statement in the beginning which checks if the screen is off, if it is off it starts Spotify, else it just sets the volume to 7.

  4. Quint

    Doesn’t work on Lollipop on my G3, but I found another way of doing this.

    Using the Autoinput plugin for Tasker works.

    Add an Autoinput Action with the following fields:
    1) Action: Click
    2) Field Type: Id
    3) com.spotify.music:id:playPause

    Use this in place of the Media Utilities command above.

    • Quint

      Actually, I got tipped off to an even better solution.

      Replace the Media Utilities plugin “Play” command with the following intent:

      Action: com.spotify.mobile.android.ui.widget.PLAY
      Cat: None
      Package: com.spotify.music
      Target: Broadcast Receiver

      Works flawlessly. I am also using it in a Profile/Task that pauses Spotify whenever I get an email and reads the notification to me before resuming Spotify.

  5. Quint

    Same command as play. It’s a toggle, there is no direct intent command for the widget that is for pause that I am aware of.

  6. Scrat

    Works perfectly for me.
    Two question. Is it possible to shuffle the play List and then start playing it. And is it possible to slowly raise the volume. For example from 1 to 7 in 3 seconds.
    Would be awesome if someone can tell me the Code

  7. Moblo

    Works graet. Is it possible to start the app with a Spotify Connect device (Gramofon, Allplay Speaker)? This be very helpful. Also as already asked, to start in shuffle mode. Thanks

  8. Mike

    I’m using Sony Z3 Compact wuth Android 5.0.2. and it is not working.
    It Spotify starts playing only, if I started Spotify manually, than tapped the Shuffle button,paused Spotify. Only then the intend is working. At that point I do not like Spotify.

  9. Javier

    It works very well, but only if i recenctly used spotify, if i’ve just rebooted my device, or havent used the app for a while, it doesn’t know what to play, it kinds of forgets the last played track, so it just opens and stays there. Does anyone have a solution for this? i’ve checked if any other app is force closing it but i think everything is fine, i don’t know how to fix this. Any thoughts?

    • Rodrigo Demoner Massad

      Yes, same thing here. I’m looking for something that can put some random playlist do to the play or something like that. If i find i’ll tell u!

      • Rodrigo Demoner Massad

        Guys, i guess i’ve found a solution when spotify doesn’t know what to play. (reboot device or havent used the app for a while)

        I took this idea from an user call Navycow in reddit’s topic. He use in a diferrent way to set the play task (he uses run shell that requires root, very good idea thought!)

        What you have to change here is the open app task
        Don’t use Launch App. Use Net-Browse URL and put http://open.spotify.com/user//Starred

        At first, you will need to choose spotify do open as aways.

        Soo, what this command does?? He open your spotify with the player already.

        of the rest use the same things.

  10. Im using a s5 and its not working completely. When I hit the test, it opens and does it perfectly, but when I plug in the headphones nothing happens. The task and profile say its activated but nothing happens. Did I do something wrong? is someone else having this issue?

    Thanks again!


    Not working with Sony E6533 upgraded to Marshmallow (nor previously with Lollipop). I saw a lot of forums citing Spotify does not start or play if the screen is locked. Any experience with that?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s