Notification with Music Streaming app icons V1.0 2019-09-24

Get a Notification with Music Streaming apps icons as you plug your headset on the mobile device

  1. Mario Dias
    With this Tasker project, a Notification with Music Streaming app icons (like Spotify and YouTube Music) will be shown up on the mobile device when you plug in some headphones. Clicking on icons will open the apps. The Music Notification will disappear when you remove the headphones from your device.

    As a pre-requisite you need to have AutoApps and AutoNotification apps installed, besides Tasker.

    STEP 1 - CREATE A PROJECT


    Create a project “Plug_Unplug Headset”

    • Click on the tab “Base”, click on “Add +”, name it “Plug_Unplug Headset”


    STEP 2 - CREATE A PROFILE FOR HEADSET PLUGGED AND HEADSET UNPLUGGED


    Create a Profile “Headset Plugged_Unplugged”

    • On the tab “PROFILES”, click on “+” > “State” > “Hardware” > “Headset Plugged”
    • Back arrow



    STEP 3 - CREATE A TASK: SAY HEADSET PLUGGED


    Create a task “Say Headset is Plugged”, As the state “Headset Plugged” becomes active, it will say “Headset is plugged” and show a Notification with Music app icons

    • Click on “New task +”, name it “Say Headset is Plugged”
    • Click on “+” for a new Action > “Alert” > “Say” and type “Headset is Plugged” on the field “Text”
    • Back arrow
    • Click on “+” for a new Action > “Plugin” > “AutoNotification” > “Buttons Notification” > “Configuration” > “Images” > “Status Bar Icon” and then select the filter “ic_action_music_1” or any other that you prefer
    • Click on “Images” > “Yes” and then select the Spotify icon. Click on “+” to add the Youtube Music icon. Finish with “Done”.
    • Go back
    • Click on “Texts”
    • Texts: write the names of the apps selected above separated by a comma. Like this: “Spotify, Youtube Music”. Finish with “OK”
    • Go back
    • Click on “Actions”
    • Actions: type the packet names of the Music apps you want to show, separated by a comma. Like this: “com.spotify.music, com.google.android.apps.youtube.music”. You can get those app names for instance from Google Play on your portable https://play.google.com/store/apps/, by clicking on the app icon. The packet name of the app then appears on the command line after “https://play.google.com/store/apps/details?id=”. Finish with “OK”
    • Click on “Action Prefix”
    • Action Prefix: write “openapp”. Finish with “OK”
    • Go back
    • Click on “General”
    • Click on “ID”
    • ID: write “music_notif”. Finish with “OK”
    • Go back
    • Click on “√ ” to finish
    • Back arrow to finish the Action
    • Back arrow to finish the Task



    STEP 4 - CREATE A TASK: SAY HEADSET UNPLUGGED


    Create a task “Say Headset Unplugged” that will do the following as the state “Headset Plugged” is deactivated: say “Headset unplugged” and clear the icons on the Notification

    • Click on the tab “PROFILES”, click on the profile “Headset Plugged_Unplugged” and then press firmly the Task “Say Headset is Plugged”
    • Click on “Add Exit Task” > “New Task +” and name it “Say Headset Unplugged”
    • Click on “+” for a new Action > “Alert” > “Say” and type “Headset Unplugged” on the field “Text”
    • Back arrow
    • Click on “+” for a new Action > “Plugin” > “AutoNotification” > “Cancel” > “Configuration” > “ID”
    • ID: write “music_notif”. Finish with “OK”
    • Click on “ ” to finish
    • Back arrow to finish the Action
    • Back arrow to finish the Task



    STEP 5 - CREATE A PROFILE TO OPEN THE MUSIC APP


    Create a Profile “Open apps”

    • On the tab “Perfis”, click on “+” > “Event” > “Plugin” > “AutoApps” > “Configuration” > “Command Filter”
    • Command Filter: write “openapp=:=”. Finish with “OK”
    • Click on “Variable Names”
    • Variable Names: write “app_open”. Finish with “OK”
    • Go back
    • Back arrow to finish the Event



    STEP 6 - CREATE A TASK: OPEN MUSIC


    Create a task “Open Music”, As the event becomes active, it will open the selected music app

    • Click on “New Task +” and name it “Open Music”
    • Click on “+” for a new Action > “App” > “Launch app”
    • Click on one of the shows apps
    • Click on
    • Click on the text field under “App” and erase the app name. Instead, write “%app_open”
    • Back arrow to finish the Action
    • Click on “+” for a new Action > “Input” > “Close System Dialogs”
    • Back arrow to finish the Action
    • Back arrow to finish the Task
    • Click on “√ ” to finish



    STEP 7 - TEST IT


    After this Project is activated, if you insert the headset you will hear a notice “Headset is Plugged” and a notification will appear with both music apps Spotify and Youtube Music. If you press any, the app will open.

    If you unplug the headset, the notification will disappear