Monday, August 12, 2013

Fun with NFC Tags and Tasker for Android

I was wanting to do something with a bunch of NFC tags I had laying around and finally found a real life use case that I have everyday. When I get in my car I hook my phone up to the speakers and play music from the Google's Play Music App. After loading the app I have to find the playlist I want and it really just becomes too many button presses for me. So I came up with the idea to use the NFC tags to launch the app and auto play a given playlist. I have a couple NFC tags set up now for different playlists and when I tap a tag it loads up and starts playing. To do this I used a combination of NFC Task Launcher, Tasker, and a plugin for Tasker called Tasker AutoShortcut. Click the jump to see a guide on how to set this up.

  1. The first thing you do to do is install Tasker and Tasker AutoShortcut which can be found on the Play App Store. Tasker isn't free, but if you want to automate tasks on your phone I highly recommend it.
  2. Next is to go into Tasker touch the 3 dots at the top and go to Preferences->Misc and make sure Allow External Access is checked. This is so NFC Task Launcher can launch Tasker tasks after tapping an NFC tag.

  3. You should then install NFC Task Launcher. Make sure the installation is done in this order otherwise it will cause problems. Tasker must be installed first because of permissions being granted to NFC Task Launcher. If you get an error saying "Permission to launch task..." when trying to launch a task with NFC Task Launcher, this is the reason why and you must uninstall NFC Task Launcher and reinstall it.
  4. The next steps are going to set up the task in Tasker so open it up and click the Tasks tab and then the + button. Make note of what you name the task because we are going to need that name later.

  5. After creating a new task it will open up to a blank screen that you need to add the steps to the task to. Touch the + button and select Plugins->AutoShortcut.
  6. Click the Edit button and scroll until you find the icon that is a black square with a blue play button inside it. Then select the playlist you want.
  7. After selecting a playlist click the back arrow by the word Action Edit and you should see that the action is added. Add another action by clicking the + button. This time we want to select Media->Media Control.
  8. Select Toggle Pause in the dropdown menu and make sure Simulate Media Button is unchecked.You can test it by hitting the back arrow until you see all the actions of the task and then press the Play button towards the bottom of the screen.
  9. If all that worked it is time to load up NFC Task Launcher. Click on My Tasks and then the + button. This should open up a window to select what type of trigger you want to launch the task. Choose NFC. This should open up a new task that you can name and add actions to. Change the name if you want and then click the + button.
  10. Next it is going to want to know what you want to launch. Scroll to the bottom of the list and select Tasker->Tasker Task. Then type in name of the task you want to launch. It is important that this matches exactly what you put into to Tasker otherwise the task will fail to launch giving an error of "Broadcast Error: ...". That is why I mentioned to make a note of the name earlier.
  11. Finally write the task to the NFC tag by touching the next arrow towards the top of the screen and placing the tag near the phone. It should tell you it wrote successfully and now when you touch the tag to the phone it should launch your playlist and automatically start playing music.

No comments:

Post a Comment