Skip to content

Instantly share code, notes, and snippets.

@AppWerft
Created September 14, 2018 07:35
Show Gist options
  • Save AppWerft/a302d6a10aff3e9d3a2aa95177bea40e to your computer and use it in GitHub Desktop.
Save AppWerft/a302d6a10aff3e9d3a2aa95177bea40e to your computer and use it in GitHub Desktop.
function onLocation(e) {
const coords = (Ti.App.Properties.getBool("MOCKING") == true) ? {
latitude : Ti.App.Properties.getString("MOCK_LOCATION").split(',')[0],
longitude : Ti.App.Properties.getString("MOCK_LOCATION").split(',')[1],
} : e.coords;
$.mapView && $.mapView.onLocation(coords);
$.panoView && $.panoView.onLocation(coords);
}
$.addEventListener("open", function() {
Log('OPEN');
Ti.Geolocation.addEventListener('location', onLocation);
});
$.addEventListener("close", function() {
Log('CLOSE');
Ti.Geolocation.removeEventListener('location', onLocation);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment