title: FusedLocationProviderClient getLocationAvailability needs a delay to give a correct result
body: <p>I'm trying to get last location checking first if GPS is enabled, I ask user to go to settings to enable it if it's not, and when I go back from settings  to my app, after enabling GPS location, and I check if GPS is available, I get it's not enabled, after a delay (1-2 seconds) I get it is.</p>
  
  <p>Why there is that delay in fusedLocationProviderClient.getLocationAvailability() method? How can I solve it?
  Here's the code:</p>
  
  <pre><code>@Inject
  FusedLocationProviderClient fusedLocationProviderClient;
  
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
  
      checkAndGetLastLocation();
  }
  
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      if (requestCode == GPS_ENABLE_REQUEST) {
          checkAndGetLastLocation();
      } else {
          super.onActivityResult(requestCode, resultCode, data);
      }
  }
  
  @SuppressWarnings("MissingPermission")
  private void checkAndGetLastLocation() {
      fusedLocationProviderClient.getLocationAvailability().addOnCompleteListener(getActivity(), availabilityListener -&gt; {
          if (availabilityListener.isSuccessful() &amp;&amp; availabilityListener.getResult() != null &amp;&amp; availabilityListener.getResult().isLocationAvailable()) {
              showProgress();
              getLastLocation();
          } else {
              showGPSDisabledDialog();
          }
      });
  }
  
  public void showGPSDisabledDialog() {
      hideProgress();
  
      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
      builder.setTitle(R.string.gps_disabled_title);
      builder.setMessage(R.string.gps_disabled_message);
      builder.setPositiveButton(R.string.enable_gps, (dialog, which) -&gt; {
          dialog.dismiss();
          startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), GPS_ENABLE_REQUEST);
      }).setNegativeButton(R.string.not_enable_gps, (dialog, which) -&gt; {
          switchToManualMode();
      });
      AlertDialog mGPSDialog = builder.create();
      mGPSDialog.setCancelable(false);
      mGPSDialog.show();
  }
  
  @SuppressWarnings("MissingPermission")
  private void getLastLocation() {
      locationListLayout.setVisibility(View.VISIBLE);
      addLocationButton.setVisibility(View.VISIBLE);
      addLocationListLayout.setVisibility(View.GONE);
      searchLocationsButton.setVisibility(View.GONE);
  
      fusedLocationProviderClient.getLastLocation()
              .addOnCompleteListener(getActivity(), locationListener -&gt; {
                  if (locationListener.isSuccessful() &amp;&amp; locationListener.getResult() != null) {
                      Location lastLocation = locationListener.getResult();
                      locationStep1Presenter.getSites(lastLocation);
                  } else {
                      Log.d(this.getTag(), "checkAndGetLastLocation:exception", locationListener.getException());
                      hideProgress();
                      showNoSitesToShowError();
                  }
              });
  }
  </code></pre>