Sunday, January 8, 2017

Automatically Avoid Tolls in Google Maps with Tasker

I love getting around on my bicycle. Thanks to Google Maps, finding the destination and arriving there on time has never been an issue for me. There are a few caveats though if you are a cyclist:

  • I'm a roadie. Me and bike paths are not friends. I stick to roads, I don't feel comfortable zipping at 40km/h  centimeters from pedestrians. (For my imperial friends out there, it's inches too close, when I'm going way too fast). Therefore, unless a special occasion calls for it, I use Google Maps – driving navigation.
  • Google Maps also underestimates my ETA, which is annoying. I'm young and fit for now. I'm sure I will appreciate it more in my 50s. I'd like to see an average speed slider to adjust notifications about ETA and 'leave now to get on time' notifications.
  • When using Google Maps for cars, you have to be careful not to end up on a highway, (which is often the case around my area) or other roads that may not be suitable for cycling. But the same goes for the biking directions.
    img_20160229_123834

    Google forgot to mention: "Buy a mountain bike for this bit'

But that's just my preferences. For our motorist friends out there, you're probably more concerned about avoiding those toll roads when commuting. Sure, using the toll road a few times might not be too expensive, but it can be pricey if you use it quite extensively.

If you would rather avoid toll roads entirely, then you have to remember to manually toggle the option before starting navigation, or to start navigation and then manually specify to change your route. Luckily, we can use Tasker to specify our preferred route before starting navigation! We've provided a set of instructions below for you to replicate the project, otherwise you can simply skip to the bottom to download and import the project file. Whatever you prefer.

You will need:
Android version: 4.0+ (Used 7.0),
Apps: Google Maps
Plugin: AutoVoice
Needs: N/A

This project was initially created by Mishaal Rahman, but through discussion, experimentation, and collaboration was later expanded upon by myself.


Specifying driving instructions with Tasker

avoid highways with TaskerGoogle Maps provides you with some voice commands to toggle the tolls/highways/ferries option, which wasn't the case earlier on. You can request your route to be changed accordingly by saying:

"Avoid tolls/highways/ferries" (Come on Google it's called motorways around here!)

Frankly speaking, this is something I often forget to do when setting off. So here is how Tasker could help you. The profile "Avoid Tolls" will allow you to preset the travel mode. I have mine (avoid highways) linked to my bike mode. So whenever my phone is on the bike (NFC context inside my bike case) it will bring up the Google Maps directions for driving, avoiding motorways.

Here is how to avoid Tolls/Highways/Ferries with Tasker:

avoid highways with Tasker

Avoid Tolls/Highways/Ferries

  Profile: Avoid Tolls      Event: AutoVoice Recognized [ Configuration:Command: "navigate to" ]  Enter: Avoid Tolls      <tolls>      A1: Send Intent [ Action:android.intent.action.VIEW Cat:None Mime Type: Data:google.navigation:q=%avcommnofilter&avoid=t Extra: Extra: Extra: Package:com.google.android.apps.maps Class: Target:Activity ]      <highways>      A2: Send Intent [ Action:android.intent.action.VIEW Cat:None Mime Type: Data:google.navigation:q=%avcommnofilter&avoid=h Extra: Extra: Extra: Package:com.google.android.apps.maps Class: Target:Activity ]      <ferries>      A3: Send Intent [ Action:android.intent.action.VIEW Cat:None Mime Type: Data:google.navigation:q=%avcommnofilter&avoid=f Extra: Extra: Extra: Package:com.google.android.apps.maps Class: Target:Activity ]      A4: Kill App [ App:Google Use Root:Off ]  

The profile responds to our AutoVoice Recognized event and the command 'navigate to' then passes whatever you say afterwards as the destination. For instance, if you say "navigate to McDonald's" then Tasker will pass "McDonald's" as a destination to Google Maps while starting navigation with the avoid option you selected. Don't worry, Google Maps is fairly flexible about what you can put in the destination – you can even just say "home" or "work" assuming you have those locations set up in the Google Maps app. The destination is stored in %avcommnofilter (which is the first command available without the words put in the filter).

The intent created contains the limitations we want to apply:

  • Avoid tolls: avoid=t
  • Avoid highways: avoid=h
  • Avoid ferries: avoid=f

tasker avoid highwaysTo build an intent simply add a send intent action and fill in the following fields:

  Action:android.intent.action.VIEW  Data:google.navigation:q=%avcommnofilter&avoid=t,h,f  Package:com.google.android.apps.maps  Target:Activity  

Note the bolded t|h|f above, you can specify which avoid options you want by listing each letter in a comma separated list. Generally, motorists will specify just t for tolls, but if you want to avoid highways and ferries you can place h,f at that part. If you want to speed things up you can add the Kill App: Google App action, but this step is not required.

The project "Avoid Tolls with Tasker" contains all 3 intents, so if you are going to use the file, please disable the unwanted intents by clicking on the action to see which intent it is sending. While on it's own this project may not be the most impressive navigation tip, it can remove a lot of frustration from your navigation profiles. In my case, this Task helps to alleviate the frustration of forgetting to set the correct navigation option when I'm cycling. For Mishaal, it helps because he frequently starts navigation using his voice, but forgets to set the avoid tolls option.

Download the project here!

In order to import a Tasker project file, download the above file and save it anywhere in your internal storage. Open up Tasker and check to make sure that "beginner mode" is disabled in the preferences menu. Then, long-press on the "home" icon in the bottom left hand corner and click on "import". Find the prj.xml file you saved earlier, and select it to import it. You will now see a new tab in the bottom row containing all of the profiles and tasks we referenced in this article.

We hope you enjoy this little creation of ours, and let us know if you think we can make any enhancements!



from xda-developers http://ift.tt/2j79rfL
via IFTTT

No comments:

Post a Comment