Question

I am trying to open Apple Maps in my PhoneGap app when a user clicks on a link. The URL scheme in Apple's documentation is like http://maps.apple.com/maps?ll=51.83733,-8.3016, which opens Apple Maps if it is present, else redirects to Google Maps. But when I click on this link, it opens Google Maps Web App instead, and there is no way to go back to the app.

Searching for a solution, I found this SO question - Phonegap - Open Navigation Directions in Apple Maps App It suggests using maps: instead of http://maps.apple.com/?q=somePlaceName. This works fine and opens the native Apple Maps app. But I want to pass latitude and longitude instead of a place name.

I tried with maps?ll:51.84,-8.30, but it doesn't work.

Was it helpful?

Solution

You need to add the InAppBrowser plugin to your project and open the link with the system web browser, which will automatically redirect to Apple Maps:

var mapLocationUrl = 'maps.apple.com/?ll=51.84,-8.30';
var ref = window.open(encodeURI(mapLocationUrl), '_system', 'location=no');

Check the official Apple URL Scheme Reference for the complete list of parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top