title: Geofencing and GoogleApiClient
body: <p>I am using Geofencing for my app and i followed the steps declared <a href="https://developer.android.com/training/location/geofencing.html" rel="nofollow">here</a>
  But everytime i try initializing GoogleApiClient i am unable to recieve any call backs..following is my code..</p>
  
  <pre><code>mGoogleApiClient = new GoogleApiClient.Builder(this)
  .addConnectionCallbacks((GoogleApiClient.ConnectionCallbacks)this)
  .addOnConnectionFailedListener(this)
  .addApi(LocationServices.API).build();
  </code></pre>
  
  <p>i get a force close error </p>
  
  <pre><code>java.lang.IllegalStateException: GoogleApiClient is not connected yet.
  </code></pre>
  
  <p>Code in onCreate()</p>
  
  <pre><code>geoFence = new Geofence.Builder()
              .setRequestId("DVSN")
              .setCircularRegion(18.5553785, 73.8164671, 10)
              .setExpirationDuration(43200000)
              .setTransitionTypes(
                      Geofence.GEOFENCE_TRANSITION_ENTER
                              | Geofence.GEOFENCE_TRANSITION_EXIT).build();
      LocationServices.GeofencingApi.addGeofences(
              mGoogleApiClient,
              getGeofencingRequest(),
              getGeofencePendingIntent()
      ).setResultCallback(this);
  </code></pre>
  
  <p>private methods</p>
  
  <pre><code>private GeofencingRequest getGeofencingRequest() {
      GeofencingRequest.Builder builder = new GeofencingRequest.Builder();
      builder.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER);
      builder.addGeofence(geoFence);
      return builder.build();
  }
  
  private PendingIntent getGeofencePendingIntent() {
      // Reuse the PendingIntent if we already have it.
      Intent intent = new Intent(this, GeofenceTransitionsIntentService.class);
      // We use FLAG_UPDATE_CURRENT so that we get the same pending intent
      // back when
      // calling addGeofences() and removeGeofences().
      return PendingIntent.getService(this, 0, intent,
              PendingIntent.FLAG_UPDATE_CURRENT);
  }
  </code></pre>