I have a problem. When I indicate the key NSLocationAlwaysUsageDescription in info.plist (or tiapp.xml), everything works fine.
But how do I make geolocation work in such mode that it's only activated in foreground? I was trying to use the key NSLocationWhenInUseUsageDescription, but although the authorization message is correct, the "location" event is not firing!
When I replace the NSLocationWhenInUseUsageDescription by NSLocationAlwaysUsageDescription, everything works as expected.
The code is trivial:
Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS; Ti.Geolocation.frequency = 10; Ti.Geolocation.distanceFilter = 5; Ti.Geolocation.trackSignificantLocationChange = true; Ti.Geolocation.accuracy = 10; var func = function(e) { alert("geolocation"); } Ti.Geolocation.addEventListener("location",func);