Logo Questions Linux Laravel Mysql Ubuntu Git Menu

How Google estimate my location without GPS?

I was wondering how Google done this.

Locate me with a good accuracy when my GPS is disabled.

First I thought Google taking information from the cell tower, then i came to know that Google is not taking my cell tower and GPS to show my accurate location.

Does any one know how that works ?

like image 620
Ajay Venugopal Avatar asked Mar 17 '23 23:03

Ajay Venugopal

2 Answers

Google and others like Apple and Skyhook build a Database which links WLAN BSSIDs to a geographic location. A BSSID is like the MAC Address of a access point that gets broadcasted by that access point. It is therefore "public viewable" if the BSSID broadcast is enabled, which is the default for most access points. The BSSID operates on a lower layer as the IP stack, you don't even have to be connected to an access point to receive these broadcasts.

Every time you run Google Maps or Navigation with enabled GPS and WiFi and if your device is able to get a good GPS fix, the current visible WLAN networks and your current location (the GPS fix) are uploaded to Google to build and update the database. This technique is sometimes called crowdsourcing. Every Android device acts therefore as data collector. You can read more about this here.

Since most access points are static in their position and only cover a small area - the coverage radius is approximately 100m - they are ideal anchors for a good location fix without GPS.

Another way to locate computers is by looking up it's IP address in geolocation databases. However, this is not used in Android, since mobile devices do not have fixed locations.

like image 93
BSavaliya Avatar answered Mar 28 '23 23:03


What you are looking to do is get the position using the LocationManager.NETWORK_PROVIDER instead of LocationManager.GPS_PROVIDER. The NETWORK_PROVIDER will resolve on the GSM or wifi, which ever available. Obviously with wifi off, GSM will be used. Keep in mind that using the cell network is accurate to basically 500m.

http://developer.android.com/guide/topics/location/obtaining-user-location.html has some really great information and sample code.

After you get done with most of the code in OnCreate(), add this:

// Acquire a reference to the system Location Manager
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
    public void onLocationChanged(Location location) {
      // Called when a new location is found by the network location provider.

    public void onStatusChanged(String provider, int status, Bundle extras) {}

    public void onProviderEnabled(String provider) {}

    public void onProviderDisabled(String provider) {}

// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

You could also have your activity implement the LocationListener class and thus implement onLocationChanged() in your activity.

Hope it will help you.

I have took reference and coded from some link but i don't know the source link.

Let me know if you need more help from my side on same.

like image 40
Vatsal Shah Avatar answered Mar 28 '23 23:03

Vatsal Shah