title: Get current position with GPS AND WIFI
body: <p>I'm currently using GPS only to get current location of the user to return certain results. As in Belgium, if you're inside, most of the time you can't get GPS-connection. So I want to get the current location with the wifi-connection.</p>
  
  <p>I've found this example: <a href="https://stackoverflow.com/questions/2699215/get-the-current-location-gps-wifi">get the current location (gps/wifi)</a>
  But </p>
  
  <p>I'm not sure which lines tell the device which connection to choose. I'm guessing it's this one: <code>String provider = myLocationManager.getBestProvider(criteria,true);</code> That I've to add to my code.</p>
  
  <p>When I check what's inside of this, I always get a null-value, I don't quite understand why.</p>
  
  <p>My code looks currently like this:</p>
  
  <pre><code>public void getOwnLngLat(){
  LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
  final LocationListener locationListener = new LocationListener(){
  
  public void onLocationChanged(Location location) {
      // TODO Auto-generated method stub
      longitude="" + location.getLongitude();
      latitude="" + location.getLatitude();
  }
  
  public void onProviderDisabled(String provider) {
      // TODO Auto-generated method stub
  
  }
  
  public void onProviderEnabled(String provider) {
      // TODO Auto-generated method stub
  
  }
  
  public void onStatusChanged(String provider, int status,
                  Bundle extras) {
      // TODO Auto-generated method stub
  
     }        
  };
  locationManager.requestLocationUpdates(locationManager.getBestProvider(new Criteria(), true), 2000, 10, locationListener);
  }
  </code></pre>