Do you like listening to music? Well, who doesn’t? The type of music one prefers to listen might be different, but still, people do love to listen to music. Be it while commuting, gaming, working or even studying. Yes, there are many friends of mine who listen to music while studying. Maybe that helps them concentrate more by isolating the surrounding noise and listen to their favorite tracks.
Some listen to music for the love of it, but, there are some who simply put on their earphones to avoid people. This is real, people often put on their earphones and listen to music, or at least pretend to be doing so in order to be able to avoid having to talk to someone.
Now, if you are the one who can’t wait to play your favorite music as soon as the earphones are plugged in to your smartphone, this guide is for you. What if we told you there’s a way through which you can automatically play music as soon as you plug in the earphones in your smartphone? You don’t even need to manually launch any app. If this sounds like you, we won’t call you lazy and judge you. No sir.
How to automatically play music when you plug in earphones
Step 1: The very first thing to do is to download the ‘Tasker‘ app. It’s a paid app and will cost you Rs. 199.99. But, a trial version is also available. Now, after you have installed the app on your Android, you need to go to Settings > Accessibility > Tasker.
Tasker would be turned off by default. Turn the toggle button ‘On’ to enable it. This is required in order for Tasker to function properly.
Step 2: Now, open the Tasker app and tap on the ‘+‘ button provided at the bottom in the ‘Profiles‘ tab. After that, select ‘State‘ then ‘Hardware‘.
After that, select the ‘Headset Plugged‘ option. Now you will be taken to the State Edit screen. Set the Type to ‘Any‘ and press the back button of your device once.
Step 3: As soon as you go back one step, you will be asked to add a new task to your profile. Tap on ‘New Task‘ and give any name to the task and then tap on the ‘tick mark‘ symbol. We gave the name ‘Launch Play Music’ to keep things simple.
Step 4: You now need to add an action in the Task you just created. In our case, Launch Play Music. You will find a ‘+‘ symbol at the bottom of the task screen. Tap on it and selected ‘App‘ from the Action Category.
Select the ‘Launch App‘ option from the App Action category. We would like Google’s Play Music app to start playing music automatically as soon as the earphones are plugged in, so we selected the Play Music app. You can choose any other music app that you like. After choosing the app, you will be taken to the Action Edit menu. Leave it as it is and press the back button on your device once.
Step 5: Going back will take you to the Task Edit menu of Launch Play Music task. Add one more action. Select the ‘Media‘ action category this time.
Select ‘Media Control‘ from the Media Action category. This will take you to the Action Edit menu of Media Control.
The ‘Cmd’ in the Action Edit menu of Media Control will be ‘Next’ by default. Change it to ‘Play [Simulated Only]‘. Now press the back button on your device twice to go back to the main menu of Tasker.
Step 6: All the above steps took care of playing music automatically when the earphones are plugged in. What about stopping it? You need to add an ‘Exit Task‘ in the profile to stop the task. Long press on the ‘Launch Play Music‘ task. This will provide you with an option to ‘Add Exit Task‘. Tap on it.
Then tap on ‘New Task‘ and give a name to it. We gave the name ‘Close Play Music‘, but you can give any name you like.
Step 7: Adding a new task will take you to the Task Edit menu. You need to add an action again. Select ‘Media‘ from the Action category and ‘Media Control‘ from the Media Action category.
You will be taken to the Action Edit menu of Media Control where you need to set the ‘Cmd’ to ‘Pause‘.
Press the back button on your smartphone once after you set the ‘Cmd’ to ‘Pause’. You will be taken to the Task Edit menu.
Add one more action from the Task Edit menu. Select ‘Go Home‘ from the ‘App‘ Action category. You will be presented with a slider in the Action Edit menu. Use it to select the home screen that you would like to see after unplug your earphones.
Now press the back button of your device twice to go back to the main menu of Tasker. That’s it. You have automated the entire process.
The ‘Headset Plugged Any‘ is the main profile whereas the ‘Launch Play Music‘ and ‘Close Play Music‘ are the tasks of the main profile.
Now, to verify, just plug in your earphones and see Tasker doing wonders. The Play Music app will automatically start playing music as soon as the earphones are plugged in. The music will stop playing and the Play Music app will close when you unplug the earphones. Isn’t that cool? Sure it is.
Head on to our How-To Guides section for more such cool tutorials.
Also read: How to automatically prevent notifications from pausing music [Android Guide]