still under construction, but feel free to explore :)
HOME / Articles/Tutorials / Android Articles/Tutorials / Android Internals / Android Location Providers Internals

Android Location Providers Internals

Internal overview of Android location providers




This artcile is based on Android 4.3 API 18, however olders APIs might be mentioned
for development tutorial using Location APIs check http://web.djodjo.org/article/articles/android_articles/dev/general/location_and_maps intead.

1. About this insider

In this article the main topic are the Location Providers and Location Service in Android or mostly how location data is processed and delivered to the user.
We will also mention Google Location Services API, which is also used to fetch a location but it is a closed source.

2. android.location.LocationManager

Source link:
Build tree path: /frameworks/base/location/java/android/location/LocationManager.java

android.location.LocationManager is a wrapper that for most of its part is calling android.location.ILocationManager, implemented in com.android.server.LocationManagerService.

3. com.android.server.LocationManagerService

Source link:
Build tree path: /frameworks/base/services/java/com/android/server/LocationManagerService.java

4. android.location.LocationProvider

Source link:
Build tree path: /frameworks/base/location/java/android/location/LocationProvider.java

This is just a wrapper used to return name and properties of a specific provider via LocationManager.getProvider(String name). All the other calls are made by LocationManagerService to the actual Provider implementations.

5. com.android.server.location.LocationProviderInterface

Source link:
Build tree path: /frameworks/base/services/java/com/android/server/location/LocationProviderInterface.java

6. com.android.server.location.GpsLocationProvider

Source link:
Build tree path: /frameworks/base/services/java/com/android/server/location/GpsLocationProvider.java

7. com.android.server.location.PassiveProvider

Source link:
Build tree path: /frameworks/base/services/java/com/android/server/location/PassiveProvider.java

8. com.android.server.location.MockProvider

Source link:
Build tree path: /frameworks/base/services/java/com/android/server/location/MockProvider.java

9. com.android.server.location.LocationProviderProxy

Source link:
Build tree path: /frameworks/base/services/java/com/android/server/location/LocationProviderProxy.java

Proxy for the ILocationProvider implementations. It implements LocationProviderInterface and used in LocationManagerService mostly for the Fused provider.

10. com.android.internal.location.ILocationProvider

Source link:
Build tree path: /frameworks/base/location/java/com/android/internal/location/ILocationProvider.aidl

Used by LocationProviderProxy.

11. com.android.location.provider.LocationProviderBase

Source link:
Build tree path: /frameworks/base/location/lib/java/com/android/location/provider/LocationProviderBase.java

Base class for location providers implemented as unbundled services. Its service extends ILocationProvider.Stub.

12. com.android.location.fused.FusedLocationProvider

Source link:
Build tree path: /frameworks/base/packages/FusedLocation/src/com/android/location/fused/FusedLocationProvider.java

Extends LocationProviderBase and implements the calls to the service. The actual logic is done in com.android.location.fused.FusionEngine.

13. com.android.location.fused.FusionEngine

Source link:
Build tree path: /frameworks/base/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java

14. Using Google Location Services API

When com.google.android.gms.location.LocationClient is used to get Location the provider specified is "fused". This 'fused' might not be equal to the metioned fused provider above and may return different location data.

Author: DjoDjo