My web application displays a Google map with a placemark showing an offroad location. I am converting it to run on mobile.
I can successfully open the native maps app in both IOS and Android with the following PHP code and link. (Tested on Samsung Galaxy S2 running Android 4.1.2):
$latlong ='-28.546604,153.540777';
echo '<a href="http://maps.apple.com?daddr='.$latlong.'">Take Me There</a>';
The problem is it does not put any placemark on the Native Google Map showing the offroad location. It just shows the driving route, which ends at the nearest street. Same result whether I click the Navigation or the Directions option at the bottom.
I also tested it with the direct (Android-only) link like this but it made no difference:
<a href="http://maps.google.com/maps?daddr='.$latlong.'">
I tried this form of the link instead:
<a href="geo:'.$latlong.'">Take Me There</a>
It goes directly into Google Maps native without asking any initial questions about which app to use, which I prefer, but it just displays a blank map screen. If I click on the icon in the top right corner of the map it then shows the normal navigation screen, but centered on my current location and there is no placemark for my destination.
Is there any way to force the native app to display a placemark at an exact specified offroad lat/long location please?
Found the answer myself. Solution was trivially easy thanks to this stackoverflow answer
It was in fact exactly what my old code that displayed the Google map on the PC was doing. (Doh!) Just add a (label) value after the latlong to get the placemark to display. Like this:
$dest = 'my destination';
$latlong ='-28.546604,153.540777';
echo '<a href="http://maps.apple.com?daddr='.$latlong.'('.$dest.')">Take Me There</a>';
Tested and works fine on Android 4.1.2 (which is smart enough to use google maps app even though the link is pointing at Apple. I presume it works on Apple also.