Reputation: 1041
I need to open google/apple map app on iOS using Meteor js. I could do it in Andriod using window.open("geo:" + addressLongLat, "_system");
, but the same code not working iOS.
Upvotes: 7
Views: 977
Reputation: 1041
meteor add cordova:[email protected]
var addressLongLat = latitude + ',' + longitude;
window.open('maps://?q=' + addressLongLat, '_system'); //apple map
or
window.open('comgooglemaps://?q=' + addressLongLat, '_system'); //google map
Upvotes: 1
Reputation: 53341
On iOS geo: url scheme doesn't open Google maps, it can open Google Earth
Google maps app allows this three url schemes, comgooglemaps://
, comgooglemaps-x-callback://
and comgooglemapsurl://
More information about google maps url schemes
You can also use the http url, that will open the app if it's installed or a website if it isn't
More information about http urls
Also, for making window.open
work you'll have to install cordova-plugin-inappbrowser
first. Otherwise, you'll have to use a
links.
Also for Apple map you can use
window.open('maps://?q=' + addressLongLat, '_system');
Upvotes: 6
Reputation: 2253
Using a geo
appended link will prompt the user to open the location in the maps application of their choice (assuming the user has more than one maps application on their device).
<a href="geo:-32.845027,23.006867">OPEN</a>
Upvotes: 2
Reputation: 1544
Try window.open('maps://?q=' + addressLongLat, '_system');
for iOS.
Reference: https://gist.github.com/danharper/844382901f7a7b73b90a
Upvotes: 2