title: How to get Location with Wifi in Android?
body: <p>I Want get location with Wifi and work in Google map, and it's not work for me but Gps is okay and not problem.</p>
  
  <p>my code:</p>
  
  <pre><code>locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
  
  if (locationManager != null) {
      boolean gpsIsEnabled = locationManager
              .isProviderEnabled(LocationManager.GPS_PROVIDER);
      boolean networkIsEnabled = locationManager
              .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
  
      if (gpsIsEnabled) {
          locationManager.requestLocationUpdates(
                  LocationManager.GPS_PROVIDER, 5000L, 10F,
                  (android.location.LocationListener) this);
      } else if (networkIsEnabled) {
          locationManager.requestLocationUpdates(
                  LocationManager.NETWORK_PROVIDER, 5000L, 10F,
                  (android.location.LocationListener) this);
      } else {
          // Show an error dialog that GPS is disabled...
      }
  } else {
      // Show some generic error dialog because something must have gone
      // wrong with location manager.
  }
  </code></pre>
  
  <p>AndroidManifest:</p>
  
  <pre><code>&lt;uses-library android:name="com.google.android.maps" /&gt;
  
  &lt;meta-data
      android:name="com.google.android.maps.v2.API_KEY"
      android:value="AIzaSyB4C_zHeHYMTWqW4_Wpin-5jLF9S54KDSQ" /&gt;
  &lt;/application&gt;
  
  &lt;permission
  android:name="com.karyan.karyanmap.permission.MAPS_RECEIVE"
  android:protectionLevel="signature" /&gt;
  
  &lt;uses-permission android:name="com.karyan.karyanmap.permission.MAPS_RECEIVE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission    android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"  /&gt;
  
  &lt;uses-feature android:name="android.hardware.wifi" android:required="true"/&gt;
  &lt;uses-feature
  android:name="android.hardware.camera"
  android:required="false" &gt;
  &lt;/uses-feature&gt;
  &lt;uses-feature
  android:glEsVersion="0x00020000"
  android:required="true" /&gt;
  </code></pre>
  
  <p>Newtork_Provider is null when wifi in connected to Intenet.. How to Resolve Problem</p>
  
  <p>thanks..</p>