How to open default map app?

I need to open default map app of device (ios, windows phone, android) with 1 link.
When user click in a marker there is the message “click here for open your default navigator”… And it should open the navigator with directions and it should start! :smile:


Sorry if I up this but i still need this! :frowning:

Hello. Here is my code in coffeescript, but you can probably work it out:

 $scope.openMap = ->
  address = $scope.vm.article.addresses[0]
  lat = parseFloat(
  long = parseFloat(address.loc.lng)
  text =  encodeURIComponent(address.text)
  if ionic.Platform.isIOS()"{text}&ll=#{lat},#{long}&near=#{lat},#{long}", '_system', 'location=yes')  
  else"geo:#{lat},#{long}?q=#{text}", '_system', 'location=yes')

you will also need to install org.apache.cordova.inappbrowser plugin for this to work

Thank you very much!

ciao uncusino, have you solved?

yes, I have! :coffee:

please can you tell me how?

window.location.href = "maps://"+lat+","+lon;

lat = latitude
lon = longitude
(the same with google maps but you put gmaps link)

Thank you so much. I’ll try it as soon as I can.
Have I to add your string in the link?:

< // a window.location.href = “maps://”+lat+","+lon; > OPEN IN MAP APP <///a>

This is how I made it work (using cordova “device” but you can use ionic.Platform ):

var address=data.street+", "", "+data.state;
var url='';
}else if(navigator.userAgent.match(/(Android|BlackBerry|IEMobile)/)){
	//this will be used for browsers if we ever want to convert to a website
}, "_system", 'location=no');

In addition to the answers given, if you had an address string rather than lat-longs, you would use for iOS:

function launchDirections(address) { window.location.href = "maps://" + address; }

where address would be a string like: “24 Spring Street, New York, NY”