title: NETWORK_PROVIDER and GPS_PROVIDER returns null in fragments
body: <h2>Issue i am facing</h2>
  
  <p><code>nwLocation</code> &amp; <code>gpsLocation</code> are null at <code>onStart()</code></p>
  
  <h2>Manifest i have</h2>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>FrgAddNewJobsLocation.java</strong>(class extends Fragment)</p>
  
  <pre><code>@Override
  public void onStart() {
  
      super.onStart();
  
      initilizeMap();
      appLocationService = new AppLocationService(getActivity());
      nwLocation = appLocationService.getLocation(LocationManager.NETWORK_PROVIDER);
      gpsLocation = appLocationService.getLocation(LocationManager.GPS_PROVIDER);
  }
  </code></pre>
  
  <p><strong>AppLocationService.java</strong></p>
  
  <pre><code>public class AppLocationService extends Service implements LocationListener {
  
      protected LocationManager locationManager;
      Location location;
  
      private static final long MIN_DISTANCE_FOR_UPDATE = 10;
      private static final long MIN_TIME_FOR_UPDATE = 1000 * 60 * 2;
  
      public AppLocationService(Context context) {
  
          locationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE);
      }
  
      public Location getLocation(String provider) {
  
          if (locationManager.isProviderEnabled(provider)) {
  
              locationManager.requestLocationUpdates(provider, MIN_TIME_FOR_UPDATE, MIN_DISTANCE_FOR_UPDATE, this);
              if (locationManager != null) {
  
                  location = locationManager.getLastKnownLocation(provider);
                  return location;
              }
          }
          return null;
      }
  
      @Override
      public void onLocationChanged(Location location) {}
  
      @Override
      public void onProviderDisabled(String provider) {}
  
      @Override
      public void onProviderEnabled(String provider) {}
  
      @Override
      public void onStatusChanged(String provider, int status, Bundle extras) {}
  
      @Override
      public IBinder onBind(Intent arg0) {
  
          return null;
      }
  }
  </code></pre>