Google Maps for iOS is officially here, and aside from the fact that it brings a rather pleasant and powerful mapping experience to iOS built on top of Google’s wonderful data, it also brings some goodness in the form of URL schemes that not only allow developers, but also standard users to invoke the Maps app with different functionality at will. URL schemes are nothing new, but one of the benefits to users using Google Maps, for example, is that they allow users to launch the Maps app directly into different views or to begin using different aspects of the software without having to jump through hoops to get to where they want to be.
In a real-world situation, it means that we can pass in a number of different parameters to the
comgooglemaps:// URL scheme to get it to do the things that we want. In the two examples below, we outline the steps needed to invoke Google Maps and pass in an address to navigate to using Apple’s Siri digital assistant and also using the Launch Center Pro application.
Opening Google Maps directions using Siri
Siri has the ability to launch apps in iOS 6 but it can’t pass in parameters. This means that we can just use Siri to launch Google Maps, but it would be no different from pressing the app icon ourselves on the home screen. By creating a contact card containing our custom built URL scheme we can make Siri display the contact and allow us to simply tap the link address that will open Google Maps and pass in our directional parameters.
Step 1: The first step is to make sure that Google Maps for iOS is installed on the device. The custom URL schemes will only work if the app is actually present on the iPhone or iPod touch.
Step 2: Open the Contacts app and press the ‘+‘ button to add a new contact. Give the contact a name and select the Homepage field in preparation for adding the URL scheme that will invoke Maps.
Step 3: The Maps app recognizes the starting address (
saddr), destination address (
daddr), directions mode, (
directionsmode) and map mode (
mapmode) paramaters. Say, for example, we wanted driving directions from our current location to The Grand Canyon using satellite and standard map modes we would enter the following URL in the homepage field:
Note: The actual required destination would need to be added in place of The Grand Canyon used in the example above. This could be your home address that would allow you to always get directions home from the current location. Google Maps is also smart enough to recognize a blank starting address parameter, which means that we want it to take the current location as the starting address for directions.
Step 4: Save the contact, invoke Siri and give the order to call the name that you saved the contact under. When Siri replies saying there is no number associated with that particular entry, simply tap the homepage link in the calling card and it will open up Google Maps and provide the route with the passed in parameters.
Opening Google Maps directions using Launch Center Pro
Invoking the Google Maps application in directional mode follows pretty much the exact same pattern when using Launch Center Pro. For those that may not know, Launch Center Pro is a popular App Store application that allows users to set up quick actions using URL schemes meaning commonly used parts of different apps can be used instantly.
Step 1: Set up a new Action within Launch Center Pro and give it a name of your choice. Something like Maps or GMap Directions, something that is easy to understand.
Step 2: Pass in the same URL as in the Siri example above, with the only difference being that we will replace the destination address (
daddr) with the
Step 3: Setting the
[prompt] parameter will open up the keyboard entry within Launch Center Pro and allow us to manually specify a destination address. Perfect.
So there you have it. Once you get your head around URL schemes and the different parameters available, it becomes fun and easy to force supported apps to behave exactly how we want.