I see that Google combines GPS with WiFi geolocation results to increase location accuracy. Does anyone know how it's done? How is WiFi information useful when it can have 10m+ accuracy? Is it only useful when GPS fails to receive a signal?


I assume you're referring to the Fused Location Provider as discussed here: https://developers.google.com/location-context/fused-location-provider/

...which says:

Apps can take advantage of the signals provided by multiple sensors in the device to determine device location. However, choosing the right combination of signals for a specific task in different conditions is not simple. Finding a solution that is also battery-efficient is even more complicated.

The fused location provider is a location API in Google Play services that intelligently combines different signals to provide the location information that your app needs.

The fused location provider manages the underlying location technologies, such as GPS and Wi-Fi, and provides a simple API that you can use to specify the required quality of service. For example, you can request the most accurate data available, or the best accuracy possible with no additional power consumption.

The Fused Location Provider is bundled as part of Google Play Services, so we don't know the exact implementation that is deployed to devices.

However, there is a version of the Fused Location Provider (last updated in 2015) posted here in the Android Open Source Project (AOSP): https://android.googlesource.com/platform/frameworks/base.git/+/refs/heads/master/packages/FusedLocation/src/com/android/location/fused

Here's the mirror on GitHub, which is much faster to respond: https://github.com/aosp-mirror/platform_frameworks_base/tree/master/packages/FusedLocation/src/com/android/location/fused

The FusedEngine is where the magic happens - however, it's really just a multiplexer that switches between GPS and WiFi based on various conditions.

See Line 228:

    private void updateFusedLocation() {
        // may the best location win!
        if (isBetterThan(mGpsLocation, mNetworkLocation)) {
            mFusedLocation = new Location(mGpsLocation);
        } else {
            mFusedLocation = new Location(mNetworkLocation);

With all of the above being said, in the device firmware there is usually a sensor hub that combines sensor and GNSS data. My understanding is that this is outside the scope of Google's purview, though, and is handled by the OEMs. See the Android Sensor stack documentation for details. This would affect what exact position is calculated and referred to as the "GPS" or "network" location within the AOSP code.

Update September 2019

At Google I/O 2019 Google gave an in-depth presentation Seamless and Smooth Location Everywhere with the new FusedLocationProvider (Google I/O'19) that shows that the most recent iteration of the fused location provider does indeed fuse GPS, Wi-Fi, and inertial sensor data (e.g., for pedestrian dead reckoning) to provide an optimized location during outdoors->indoors->outdoors transitions, as well as indoor navigation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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