Skip to content

Instantly share code, notes, and snippets.

@almsx
Created February 10, 2015 22:29
Show Gist options
  • Save almsx/88c7eacc6dcf27bdd265 to your computer and use it in GitHub Desktop.
Save almsx/88c7eacc6dcf27bdd265 to your computer and use it in GitHub Desktop.
Platform openURL Classic
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