How to open native map app from the mobile browser

Friday, March 7, 2014
If we need in our mobile web application a link to open google map app of mobile phone to view an address, then, we can make use of html hyperlink tag for it. But,the method of opening google mag app in different devices are different. For iphone/iOS, android phones,windows phones,blackberry, all have different code to call map app from mobile browser.
For example we want to find location "New Delhi",
For Desktop:
<a href="http://maps.google.com?q=New%20Delhi">Find Us</a>

For iPhone:
An iPhone would actually hijack this URL and open the map app automatically.
But it would not plot the route. To plot the route we'd need to modify the URL to:
<a href="http://maps.google.com/?saddr=Current%20Location&daddr= New%20Delhi">Find Us</a>

Here we are setting the source address to "Current Location" and the destination address to our store. If you'd like more information about constructing query strings for Google Maps take a look at http://querystring.org. In my experience anything you can do with them on Google Maps will work in the iPhone app.
For Android:
Instead of simply hijacking URLs to Google Maps like the iPhone, Android is employing the geo: protocol which relates the specific intent to find a geographic location. For information on the geo: protocol and other 'intents' take a look at the following link.
http://developer.android.com/guide/appendix/g-app-intents.html
Here is how we'll construct our URL for Android.
<a href="geo:New%20Delhi">Find Us</a>