Android, Featured

Tasker Tutorial : Integrating Google Calendar and Google Directions Using Transit

Today I’d like to share a quick tutorial on how to use Tasker to pull data from Google Calender and Google Navigation. When Google Now first came out, it would tell you which bus you could take at what time to get to your meeting or event on time based on the location and time information available in Google Calendar. It’s every student’s dream, especially in countries like the United States or Singapore, where transit navigation is very accurate.


I loved the idea, but I wanted it to be ever so slightly better. For example, I wanted my phone to inform me well in advance at what time I should consider leaving home to get to the bus on time. I also wanted information on earlier and later buses, so I could have knowledge of my options, very similar to the way it shows in Google Directions.

Enter Tasker. I have a profile set up, which responds to a Google Calendar event reminder. (Tasker requires accessibility access for this by the way.) All my events in Google Calendar have a reminder set to pop up one hour before the event. This triggers a python script that pulls the next event details from Google Calendar, strips and parses the necessary information. Using my current location, the directions to the location is fetched and parsed again for transit details. Tasker then displays this as a notification.

This is very similar to a thread found on XDA-Dev. The idea is based on the thread, but in the thread brandall decided to do everything in Tasker. While this is completely doable it made it a little complicated to debug. Also, the profiles attached in his thread require the calendar event to have the name ‘Meeting’ and also require a description to be entered. Again, not something you cannot do, but you will have to invest a significant amount of time in case you want to make any significant change.

If you would like to setup something similar follow the steps below.

1) Install Tasker, SL4A and the Python intepreter.

2) Paste the python script from the link here in the SL4A folder. This script has to be modified depending on what you want done. To use information from your Google Calendar, you need to add your private Google Calendar link to the script. I’ve written this to pull Transit details from a xml data, but you can theoretically do anything.

3) Setup a tasker profile similar to what I have below.


4) The Task that will be performed when this context is triggered is setup as below.

5) The above task turns on GPS, finds your current location using GPS and NET, stores the location data in a file and runs the python script. The python script uses the location data written into the file along with your next calendar event information to find out transit details. This then calls the show route task.

6) The show route is attached below.


7) All you need to do now is create an event on your Calendar with location information and you are good to go!

Here are some screenshots of what it looks like after you are done.

I’ve attached the xml from Tasker here so that it can be imported. Show Route and GetCalData. I’ve used Autonotification, a tasker plugin by joaomgcd to display the notification. You will need to use this if you want a button in the notification. This entire setup is currently in a primitive stage, I haven’t added any error handling or additional functionality but I intend to. I will update this post when I do that.

BeautifulSoup is supported by SL4A in python, which can make it extremely easy to parse information. I haven’t used it in my script though, since mine was a very small program. But it is nice to know that is an option. Big shoutout to PocketTables for offering a world of useful information on Tasker. I found their posts to be extremely helpful. Tasker is an amazing application and is extremely powerful. It can allow for a world of customization. We at UnleashThePhones highly recommend it.

If you have any questions about this setup please do let me know.

  • Jr

    I was going to try your setup, but the download links to the script and the xml files are down. Anyway you can share them again? or if you can send them to me, that would be much appreciated. Thanks.(

  • Mike

    Like Jr said, the links don’t seem to be working so I made the tasks and profiles from the pictures. I’ve been testing the python script with my personal calendar-url (xml format and tested in the browser) and with GPS coordinates in the ‘location’ file (I guess this should be in the same folder as the script?) but the python script isn’t creating new files or generating any data. Should I edit anything else in the pythonscripts besides my personal url to the xml feed?

    Anyways, even if I don’t get it to work it seems that you have and it looks awesome. So kudos for this amazing profile/task/script!


    • Gabriel 1onita ?

      Hi Mike, please, did you make it working?

  • Pingback: Python with SL4A and Google Calendar()

  • Gabriel 1onita ?

    Could you please upload again the xml files? Because the only working download link is this: Apreciate your answer. Thank you in advance.

  • Joshua Harmon

    Could you please reupload the task exports to as the links for are not working.