3

When installed on iOS and Android phones, the Google Maps application registers to handle links of the form "https://goo.gl/maps/linkHash" (iOS Universal Linking or Android Deep Linking). These links directly open in the application if it is loaded, but in the mobile browser if it is not. They are perfect for messaging.

We can generate full links to maps easily (https://maps.google.com/?q=somequery), and we can shorten those links using Google's URL Shortener. Unfortunately, the result is a link of the form "https://goo.gl/linkHash" (no maps directory), and this form does not trigger the link to Google Maps in iOS and Android; they always open in the mobile browser or two-step through to the app.

I have not been able to find a documented and long-term-supported way to programmatically generate the shortened "https://goo.gl/maps/linkHash" URL. A method does not seem to be published in either the mapping APIs or shortener API.

I have found that it is simple to make the same call to https://www.google.com/maps/preview/shorturl that maps itself makes when generating a shareable short link. This creates the correct form URL for universal/deep linking, but again, I have not been able to find examples of this API in general use or in docs.

Does anyone have info on the official (proper) way to generate this form of link programmatically server side (not manually, in browser, or using a client lib)?

Hoping to use these shortened forms for messaging with a bit more confidence, and I'm hoping I've just missed something obvious. Thanks for any suggestions!

  • 1
    Well, I couldn't find out the source, but I have read somewhere that "https://goo.gl/maps/" means the proof of itself generated by Google. The Google URL Shortener API does not provide the directory feature for general users (I mean normal people). It means you can not generate the shorten URL start with "https://goo.gl/maps/", except you are a Googler. – wf9a5m75 Jan 13 '16 at 20:13
  • 1
    I have read something similar regarding google official vs. user generated, but in this case I was hoping that goo.gl shortener API would be smart enough to see the long URL was to maps.google.com or google.com/maps and "do the right thing". No luck! – Daniel Polfer Jan 13 '16 at 20:19

0 Answers0