I had the same problem with an iOS app redirecting users to the desired place (returned from nearbysearch
API) in google maps.
They mentioned above:
https://www.google.com/maps/place/?q=place_id:ChIJp4JiUCNP0xQR1JaSjpW_Hms
If you open this link in your browser, it will show a place on the google map website.
But if you try to open this link on a mobile phone, it will open the google map application instead (if it exists on the user's phone) and not redirect to safari.
Also, the google map application doesn't show the place (that link will work on the browser only).
After testing many ways for creating a link to work both in the google map application and browser, the best way is to show a place is just passing location
and place_id
within the link.
let url = "https://www.google.com/maps/search/?api=1&query=\(placeLatitude)%2C\(placeLongitude)&query_place_id=\(placeId)"