Time for action – showing the user's location on the map
This example is available for download or browse at https://github.com/myleftboot/Chapter-7-maps/tree/CurrentLocation. Perform the following steps to show the user's location on the map:
As we will be asking for the user's location, we need to add the following code to check that we are allowed to do this:
function isLocationAuthorized(_args) { //check that we are allowed to use var retVal = true; if (!Ti.Geolocation.locationServicesEnabled) return false; if (Ti.Platform.name === 'iPhone OS') { // Explain to the user why we are going to use the location services. Ti.Geolocation.purpose = _args.purpose; var authorization = Titanium.Geolocation.locationServicesAuthorization; if (authorization == Titanium.Geolocation.AUTHORIZATION_DENIED) { // user has decided to not allow this use of location retVal = false; } else if (authorization == Titanium.Geolocation...