title: Android: location detection by Cellular Network and WiFi
body: <p>I would like to build a app which will provide current location using <code>cellular Network</code> and <code>WiFi</code>.</p>
  
  <p>I like to get location from both provider simultaneously and then decide which provider give me best.</p>
  
  <p>Now i am getting location from Network </p>
  
  <pre><code>LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  LocationListener locationlistenerforNetwork = new mylocationlistenerNetwork();
  lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationlistenerforNetwork);
  
  private class mylocationlistenerNetwork implements LocationListener {
        @Override
        public void onLocationChanged(Location location) {
            if (location != null) {
            Log.d("LOCATION CHANGED", location.getLatitude() + " ");
            Log.d("LOCATION CHANGED", location.getLongitude() + " ");
            Toast.makeText(LocationActivity.this,"latitude: "+
                location.getLatitude() + "longitude: " + location.getLongitude()
                + " Provider:" + location.getProvider() + " Accuracy:" + location.getAccuracy(),
                Toast.LENGTH_LONG).show();
  
            }
        }
        @Override
        public void onProviderDisabled(String provider) {
        }
        @Override
        public void onProviderEnabled(String provider) {
        }
        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {}
        }
  </code></pre>
  
  <p>I also want location from <code>WiFi</code>. Please help.</p>