Search code examples
google-mapsgoogle-places-api

Google Maps Places URL not found on Android Google Maps


If I open this link on any browser the Google-place-id search works perfectly: https://www.google.com/maps/place/?q=place_id:ChIJJcSdk7-Zc0cRIgxgLHUWgzE

Nevertheless if I try to open that link on my mobile phone (Android), it per default uses the Google Maps app and can't find the place there. I know as a workaround I could switch my default app to browser, but I can't force all the users to switch their default app.

Any best practice what to do so the link also works and become valid on Android/Google Maps app?


Solution

  • The supported URL is https://www.google.com/maps/search/?api=1&query=%20&query_place_id=ChIJJcSdk7-Zc0cRIgxgLHUWgzE as described in Maps URLs.

    Even if you have a Place ID, the query parameter is required, to be used as a fallback in the event that ChIJJcSdk7-Zc0cRIgxgLHUWgzE is not found. You may use this in a few different ways:

    • the address of the place, if you have it, so that the user may (or may not) end up at the same location (depending on whether the address can be found)
    • the coordinates of the place, if you have them, so that the user will see the same location although not necessarily the same address (because coordinates are ambiguous)
    • query=%20 (a blank space) is a cheat to prevent fallback, if you'd rather show the user an empty map that anything else (if ChIJJcSdk7-Zc0cRIgxgLHUWgzE is not found)

    https://www.google.com/maps/place/?q=place_id:ChIJJcSdk7-Zc0cRIgxgLHUWgzE is the kind of URL that looks nice but is not supported and may stop working any time. Also, as you seem to have found out, it doesn't work everywhere, possibly because it was never meant to.