How to launch Google Maps on iPhone via web link?
Asked Answered
B

4

29

I am building a site that will have address links as well as image of a map - both of which have a link to Google Maps.

The problem is that when I click on these links using my iPhone - or any address link that shows up in an email, the result is that either the native Apple Maps app opens or the Google Maps in the browser. I want for the native Google Maps app to open every time, and ideally for every user (whose iPhone I have no control of).

If I use the Chrome app for iPhone, then there's a little trick to do this: http://www.redmondpie.com/how-to-set-google-maps-for-iphone-default-app-for-opening-map-links/

But the reality is that the trick above will not open the Google Maps app. It will open the web version of Google Maps inside the Chrome app. Then an icon shows up at the bottom asking if you want to open the native app instead. This is better than nothing, but far from ideal. I appreciate any help. Thank you. BTW, I'd like to do this without jailbreaking the iPhone - I'm looking for a solution that will work with other people's iPhones.

Bladdernut answered 14/8, 2013 at 4:59 Comment(2)
Wow these are not the answers I was hoping for. I guess there is no way to do it. Even Google says there should be an option to open a Google Maps link in the app everytime on the first time you try it, but I don't see anything like that on my iphone. support.google.com/gmm/answer/3006766?hl=enHilly
Try #21200350Hyperkinesia
P
67

You can use apple's interface which is a bit more intelligent when using different browsers and devices:

http://maps.apple.com/?q=51.507269,-0.127695

Clicking the above url on the following devices:

iPhone|iPad: Opens Apple maps app

Android: Gives you a choice to open in either Google Maps App or Google maps website

Windows Phone: Opens Google maps mobile website

Windows 8 Desktop: Opens Google maps website

Apple OS Desktop: Opens the new maps app (Mavericks)!!

For more info see: Apple URL Scheme Reference

Pluck answered 19/10, 2013 at 9:18 Comment(4)
Updated link to Apple URL SchemesKweichow
I couldn't get either native maps to open in Safari. Google map opens when clicking on the link with Chrome though.Resolute
Apple Native maps opens automatically in Chrome and Safari on Mavericks. Firefox gives you a choice.Pluck
Guys, link <a href="maps.apple.com/?q=New York"> opens Google Map on iphone in my case. Anybody knows why not native Apple Maps?Fillender
C
5

To open Google native app you need to write:

[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]];

Example :

comgooglemaps://?q=Pizza&center=37.759748,-122.427135

Cockpit answered 14/8, 2013 at 5:22 Comment(8)
Thank you Maulik, but I'm writing web sites and web apps... this seems to be code for a native app, right?!?Bladdernut
You can also specify comgooglemaps://?q=Pizza&center=37.759748,-122.427135 this link in your ahref tagCockpit
More, its a URL schema only for open native apps.Cockpit
I tried this in both Chrome and Opera on Android and it didn't work. The comgooglemaps protocol is unrecognized.Aurify
@Aurify : this is for iOS apps. This URL will open Google map app on iOS devices.Cockpit
@Cockpit Thanks for the explanation. Seems a bit ridiculous that Google didn't implement this for Android...Aurify
@Aurify : check here : #10205112Cockpit
See the documentation for more details, and note that you need to declare the URL scheme in your Info.plist as explained here.Accentual
G
2

I just tested this and it worked in pulling up Google Maps instead of the default Apple Maps application.


<a href="comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic">Testing Maps</a>

However, after deleting the Google Maps app for iOS, the link fails to open anything because that schema is no longer available and doesn't fallback to a generic maps link... almost seems like you would need to provide two links for Google Maps for iPhone and another generic Apple Map link...

Gopak answered 4/6, 2014 at 21:9 Comment(0)
W
1

Take a look at this.

It works on every device (for ios / android, it will launch google maps app else browser).

For other devices, it will launch browser.

Simple use case would be:

  1. Construct universal map URI (with encoded params)
  2. Use this URL like -

    window.open(mapUrl, '_system');

More info for window.open here

My use case required to open existing in app map navigation into some another dedicated maps app (preferably google maps app) for ios and android devices.

I use ionic v1 + cordova for building native apps. Not sure if this is perfect for your use case but hope this helps.

Walton answered 15/3, 2018 at 6:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.