Created
February 10, 2015 22:29
-
-
Save almsx/88c7eacc6dcf27bdd265 to your computer and use it in GitHub Desktop.
Platform openURL Classic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.createWindow({ | |
backgroundColor : '#FFF', | |
exitOnClose : true, | |
navBarHidden : true | |
}); | |
var btn = Titanium.UI.createButton({ | |
title : 'Abrir URL', | |
width : 200, | |
height : 50, | |
backgroundColor : '#003366', | |
color : '#FFF' | |
}); | |
var latitude = 0; | |
var longitude = 0; | |
var latitudeLugar = 19.34442; | |
var longitudeLugar = -99.223343; | |
function currentPosition(e) { | |
latitude = e.coords.latitude; | |
longitude = e.coords.longitude; | |
}; | |
Ti.Geolocation.getCurrentPosition(currentPosition); | |
btn.addEventListener('click', function(e) { | |
Titanium.Platform.openURL("http://maps.google.com/?saddr=" + latitude + ',' + longitude + "&daddr=" + latitudeLugar + ',' + longitudeLugar); | |
}); | |
win.add(btn); | |
win.open(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment