title: Android:GoogleApiClient is not connected yet?
body: <p>To update a user's current location 
  I implement the following method to my project:</p>
  
  <p>GoogleApiClient.ConnectionCallbacks,
          GoogleApiClient.OnConnectionFailedListener</p>
  
  <p>When the project is executed,The following error will occur:</p>
  
  <pre><code>java.lang.IllegalStateException: GoogleApiClient is not connected yet.
  </code></pre>
  
  <p>And there is an error in the code:</p>
  
  <pre><code>LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
  </code></pre>
  
  <p>Many solutions have been proposed,Like <a href="https://stackoverflow.com/questions/33891324/googleapiclient-is-not-connected-yet-exception">This</a> and <a href="https://stackoverflow.com/questions/29343922/googleapiclient-is-throwing-googleapiclient-is-not-connected-yet-after-onconne">This</a>
  But not solve any problem.</p>
  
  <p>Please Help To Solve It.</p>
  
  <p>My Code In onCreate Method:</p>
  
  <pre><code> @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main2);
          FirebaseCrash.report(new Exception("Exceptin"));
  
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) {
              checkLocationPermission();
          }
  
          SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                  .findFragmentById(R.id.map);
          mapFragment.getMapAsync(this);
          mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
          mGoogleClient = new GoogleApiClient.Builder(this)
                  .addConnectionCallbacks(this)
                  .addOnConnectionFailedListener(this)
                  .addApi(LocationServices.API)
                  .build();
          mLocationRequest = LocationRequest.create()
                  .setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY)
                  .setInterval(60*1000) 
                  .setFastestInterval(1*1000);}
  </code></pre>
  
  <p>And in onMapReady:</p>
  
  <pre><code>@Override
      public void onMapReady(GoogleMap googleMap) {
          mMap = googleMap;
          buildGoogleApiClient();
          mMap.setTrafficEnabled(true);
          mMap.setMyLocationEnabled(true);}
  </code></pre>
  
  <p>And This:</p>
  
  <pre><code>   protected synchronized void buildGoogleApiClient() {
          mGoogleApiClient = new GoogleApiClient.Builder(this)
                  .addConnectionCallbacks(this)
                  .addOnConnectionFailedListener(this)
                  .addApi(LocationServices.API)
                  .build();
          mGoogleApiClient.connect();
      }
  
   @Override
      public void onConnected(@Nullable Bundle bundle) {
  
   if (servicesAvailable()) {
              // Get best last location measurement meeting criteria
              mLastLocation = bestLastKnownLocation(MIN_LAST_READ_ACCURACY, FIVE_MIN);
  
              if (null == mLastLocation
                      || mLastLocation.getAccuracy() &gt; MIN_LAST_READ_ACCURACY
                      || mLastLocation.getTime() &lt; System.currentTimeMillis() - TWO_MIN) {
  
                  LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
  
                  // Schedule a runnable to unregister location listeners
                  Executors.newScheduledThreadPool(1).schedule(new Runnable() {
  
                      @Override
                      public void run() {
                          LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, MainActivity.this);//This Line Return Error
                      }
  
                  }, ONE_MIN, TimeUnit.MILLISECONDS);
              }
          }else{
              handleNewLocation(mLastLocation);
          }
  
      }
  </code></pre>
  
  <p>Thank You For Any Help :)</p>