title: GoogleApiClient is throwing "GoogleApiClient is not connected yet" AFTER onConnected function getting called
body: <p>So I found something that is not very clear for me about GoogleApiClient.
  <strong>GoogleApiClient</strong> has a function called <strong>onConnected</strong> which is run when the client is <strong>connected</strong> (for sure).</p>
  
  <p>I got my own function called: <strong>startLocationListening</strong> which is eventually <strong>getting called on GoogleApiClient's onConnected</strong> function.</p>
  
  <p>So my <strong>startLocationListening function couldn't run without a GoogleApiClient connection.</strong></p>
  
  <p>Code and log:</p>
  
  <pre><code>@Override
  public void onConnected(Bundle bundle) {
      log("Google_Api_Client:connected.");
      initLocationRequest();
      startLocationListening(); //Exception caught inside this function
  }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>private void startLocationListening() {
      log("Starting_location_listening:now");
  
      //Exception caught here below:
      LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
     }
  </code></pre>
  
  <p><strong>The exception is:</strong></p>
  
  <pre><code>03-30 12:23:28.947: E/AndroidRuntime(4936):     java.lang.IllegalStateException: GoogleApiClient is not connected yet.
  03-30 12:23:28.947: E/AndroidRuntime(4936):     at com.google.android.gms.internal.jx.a(Unknown Source)
  03-30 12:23:28.947: E/AndroidRuntime(4936):     at com.google.android.gms.common.api.c.b(Unknown Source)
  03-30 12:23:28.947: E/AndroidRuntime(4936):     at com.google.android.gms.internal.nf.requestLocationUpdates(Unknown Source)
  03-30 12:23:28.947: E/AndroidRuntime(4936):     at hu.company.testproject.service.GpsService.startLocationListening(GpsService.java:169)
  03-30 12:23:28.947: E/AndroidRuntime(4936):     at hu.company.testproject.service.GpsService.onConnected(GpsService.java:259)
  </code></pre>
  
  <p>...</p>
  
  <p>My debug log also says the <strong>onConnected function got called</strong>:</p>
  
  <pre><code>03-30 12:23:28.847: I/Locationing_GpsService(4936): Google_Api_Client:connected.
  03-30 12:23:28.857: I/Locationing_GpsService(4936): initLocationRequest:initing_now
  03-30 12:23:28.877: I/Locationing_GpsService(4936): initLocationRequest:interval_5000
  03-30 12:23:28.897: I/Locationing_GpsService(4936): initLocationRequest:priority_100
  03-30 12:23:28.917: I/Locationing_GpsService(4936): Starting_location_listening:now
  </code></pre>
  
  <p>After this I got the exception.</p>
  
  <p>Am I missing something here? I got a response for "connected" I ran my func, and I got the error "not connected" what's this? Plus one annoying thing is: I used this location service for weeks now and never got this error.</p>
  
  <p><strong>E D I T :</strong></p>
  
  <p>I added a more specific log output, just blown my mind, check this out:</p>
  
  <pre><code>@Override
      public void onConnected(Bundle bundle) {
  
          if(mGoogleApiClient.isConnected()){
              log("Google_Api_Client: It was connected on (onConnected) function, working as it should.");
          }
          else{
              log("Google_Api_Client: It was NOT connected on (onConnected) function, It is definetly bugged.");
          }
  
          initLocationRequest();
          startLocationListening();
      }
  </code></pre>
  
  <p>log output in this case:</p>
  
  <pre><code>03-30 16:20:00.950: I/Locationing_GpsService(16608): Google_Api_Client:connected.
  03-30 16:20:00.960: I/Locationing_GpsService(16608): Google_Api_Client: It was NOT connected on (onConnected) function, It is definetly bugged.
  </code></pre>
  
  <p>Yes, I just got <code>mGoogleApiClient.isConnected() == false</code> inside <code>onConnected()</code> how is it possible? </p>
  
  <p><strong>E D I T:</strong></p>
  
  <p>Since nobody could answer this even with reputation bounty, <strong>I decided to report this as a bug to Google.</strong> What came next was really surprising to me.
  Google's official answer for my report:</p>
  
  <blockquote>
    <p>"This website is for developer issues with the AOSP Android source
    code and the developer toolset, not Google apps or services such as
    Play services, GMS or Google APIs. Unfortunately there doesn't seem to
    be an appropriate place to report bugs with Play Services. All I can
    say is that this website isn't it, sorry. Try posting on the Google
    Product Forums instead. "</p>
  </blockquote>
  
  <p>Full issue <a href="https://code.google.com/p/android/issues/detail?id=162733" rel="nofollow noreferrer">report here.</a> (I hope they won't remove it just because it's silly)</p>
  
  <p>So yeah I took a look at Google Product Forums and just couldn't find any topic to post this thing, so at the moment I am puzzled and stuck.</p>
  
  <p><strong><em>Does anybody in planet earth could help me with this?</em></strong></p>
  
  <p><strong>E D I T:</strong></p>
  
  <p>Full code in <a href="http://pastebin.com/yFw1Y7sv" rel="nofollow noreferrer">pastebin</a></p>