SL4A API Help -LocationFacade

This facade exposes the LocationManager related functionality.

Once activated by 'startLocating' the LocationFacade attempts to return location data collected via GPS or the cell network. If neither are available the last known location may be retrieved. If both are available the format of the returned data is:
{u'network': {u'altitude': 0, u'provider': u'network', u'longitude': -0.38509020000000002, u'time': 1297079691231L, u'latitude': 52.410557300000001, u'speed': 0, u'accuracy': 75}, u'gps': {u'altitude': 51, u'provider': u'gps', u'longitude': -0.38537094593048096, u'time': 1297079709000L, u'latitude': 52.41076922416687, u'speed': 0, u'accuracy': 24}}
If neither are available {} is returned.
Example (python):
 import android, time
 droid = android.Android()
 loc = droid.readLocation().result
 if loc = {}:
   loc = getLastKnownLocation().result
 if loc != {}:
     n = loc['gps']
   except KeyError:
     n = loc['network'] 
   la = n['latitude'] 
   lo = n['longitude']
   address = droid.geocode(la, lo).result
The address format is:
[{u'thoroughfare': u'Some Street', u'locality': u'Some Town', u'sub_admin_area': u'Some Borough', u'admin_area': u'Some City', u'feature_name': u'House Numbers', u'country_code': u'GB', u'country_name': u'United Kingdom', u'postal_code': u'ST1 1'}]
@author Damon Kohler (
@author Felix Arends (
geocodeReturns a list of addresses for the given latitude and longitude.
latitude (Double)
longitude (Double)
maxResults (Integer) maximum number of results (default=1)
returns: (List) A list of addresses.
getLastKnownLocationReturns the last known location of the device.
returns: (Map) A map of location information by provider.
locationProviderEnabledAsk if provider is enabled
provider (String) Name of location provider
locationProvidersReturns availables providers on the phone
readLocationReturns the current location as indicated by all available providers.
returns: (Map) A map of location information by provider.
startLocatingStarts collecting location data.
minDistance (Integer) minimum time between updates in milliseconds (default=60000)
minUpdateDistance (Integer) minimum distance between updates in meters (default=30)
stopLocatingStops collecting location data.