Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

From what I understood about Android securty all applications are separated by different user-accounts and different filesystem locations.

BUT: After GPS-test has fixed my location for the first time after powerup, all other applications will fix very fast. My conclusion: This has to be something not in Android user space.

So how does this work?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

If every app had to interpret the raw GPS input itself, it would be very silly. Different apps would duplicate the same effort of decoding and interpreting the GPS input to compute a location. Different apps would end up using different libraries to do it, so each app might end up with a different idea of your location.

Instead, the process of interpreting the GPS data to compute with a location is handled centrally in Android itself. The Android system offers an interface for apps to query the location without having to worry about the details of whether it came from GPS, cell towers, or Wi-Fi networks.

This way, only the Android system has to compute the location, using any possible sources, it can give this location to many apps without duplicating effort, and (as you've noticed) each app doesn't have to start from scratch to compute the location. More recent Android versions also do clever tricks like giving a less precise location to apps that have the "approximate (network-based) location" permission but not the "precise (GPS) location" permission, regardless of which methods were actually used to determine the location.

Internally, this works with what's called a bound system service: an IPC mechanism for different processes to receive data from the service that actually computes the location. The service does run in user space, not inside the kernel, and like any other Android app it runs inside its own process. (Only the very low levels of the GPS receiver driver run inside the kernel.) The details of that are well beyond the scope of this site, but if you're interested, you can learn more by reading the Location Strategies page in the official Android Developers' Guide.

share|improve this answer
    
com.android.location.fused is a running process that sounds like that. Is that the application layer you described? –  Nils Jun 1 '13 at 21:05
    
TL;DR; Low level, the GPS caches the location fix and remembers where it left off, thereby making it easier to resume when activated. –  t0mm13b Jun 1 '13 at 23:09
    
@t0mm13b Sounds a little bit like a different answer to me (low-level is even outside Android, right?) –  Nils Jun 3 '13 at 21:20
    
@Nils - at the framework, kernel (driver) level below android :) –  t0mm13b Jun 3 '13 at 21:31
    
@t0mm13b That simply isn't true. In Linux systems (including Android), all of the heavy lifting for GPS location is done inside the user-space libgps library. As I say in my answer, the only kernel driver required is the UART driver to communicate with the GPS hardware. The kernel driver doesn't do any location calculations or caching. –  Dan Hulme Jun 4 '13 at 8:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.