Using Tasker and intents to play Google Play Music when you start driving

Friday, 13 September 2019

What you will need:

I think it is easiest to start by creating the task, so go to the tasks view and add a new task, giving it a name. In the lower right of this panel click the + to begin adding a new action, and select “System” and then “Send Intent”. The intent information can be gained from this useful reddit post but what I entered was

Action:android.media.action.MEDIA_PLAY_FROM_SEARCH
Cat:None
Mime Type:
Data:
Extra:query:Driving
Extra:android.intent.extra.focus:vnd.android.cursor.item/playlist
Extra:
Package:com.google.android.music
Class:
Target:Activity

You can then test the task by clicking the play button in the lower left, it should open up Google Play Music and begin playing the playlist you selected. Note that automatically generated playlists liked “Thumbs up” and “Last added” don’t seem to work with this method.

I had some issues if I played a radio with the same name from a previous bad attempt at running the task, but just manually playing the playlist defined in the query again seemed to correct this behaviour from ever happening again.

With that done its time to cause this task to trigger when we want it to. I use the connection to my car’s bluetooth system. In Tasker navigate to the Profiles tab and create a new profile. Select “State” as the type and then choose “Net” for the category, and then “BT Connected” You can use the magnifying glass picker icon for both the name and address rows to ensure that this only triggers when you connect to the specific bluetooth device that you want.

All that is left to do now is enable bluetooth and turn on the bluetooth device and watch Tasker start playing your music for you. I found this much simpler than fiddling with AutoTools. I just wish that it was easier to discover and use all the various intents that are available on your phone.

Written Friday, 13 September 2019

Modified Thursday, 19 September 2019.

Tagged with automation.

Categorized as “

What do you think of this post?