Tasker – Spotify Plug, Load and Play

Standard

Unti2rtled-1

 

NOTICE!
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!

Introduction:
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

STEP 1

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.

STEP 2

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.

STEP 3

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,

STEP 4

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.

STEP 5

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

AND WE’RE DONE!

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

Screenshot_2015-03-05-16-32-23