title: Android: Finding nearby places with Google Places API
body: <p>I am trying to get list of the nearby places using Google Places API. I have enabled requried API from Google Devloper Console and have an valid API key. I am able to get my corrent location. After I got the my current location I am trying to get nearby places list but it returns empty.</p>
  
  <p>I have also tried giving <code>null</code> <code>PlaceFilter</code> but it gives same result.</p>
  
  <pre><code>private class MyGoogleMapOnMyLocationListener implements
              OnMyLocationChangeListener,
              ConnectionCallbacks,
              OnConnectionFailedListener {
          private GoogleApiClient mGoogleApiClient;
  
          @Override
          public void onMyLocationChange(Location location) {
              if (!hasLastLocation) {
                  hasLastLocation = true;
                  mLastLocation = location;
                  Log.d(LOG_TAG, "Location: " + location.toString());
  
                  if (googleMap != null ) {
                      googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
                              new LatLng(location.getLatitude(), location.getLongitude()), 16.0f));
  
                      if (mGoogleApiClient == null) {
                          mGoogleApiClient = new GoogleApiClient
                                  .Builder(getActivity())
                                  .addApi(Places.GEO_DATA_API)
                                  .addApi(Places.PLACE_DETECTION_API)
                                  .addConnectionCallbacks(this)
                                  .addOnConnectionFailedListener(this)
                                  .build();
                          mGoogleApiClient.connect();
                      }
                  }
              }
          }
  
          @Override
          public void onConnected(Bundle bundle) {
              Log.d(LOG_TAG, "Google Api Client connected.");
  
              if (mGoogleApiClient != null) {
                  Log.d(LOG_TAG, "Getting nearby places...");
  
                  PendingResult&lt;PlaceLikelihoodBuffer&gt; result =
                          Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, null);
  
                  result.setResultCallback(new ResultCallback&lt;PlaceLikelihoodBuffer&gt;() {
                      @Override
                      public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
                          Log.d(LOG_TAG, "Got results: " + likelyPlaces.getCount() + " place found.");
  
                          for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                              Log.i(LOG_TAG, String.format("Place '%s' has likelihood: %g",
                                      placeLikelihood.getPlace().getName(),
                                      placeLikelihood.getLikelihood()));
                          }
  
                          likelyPlaces.release();
                      }
                  });
              }
          }
  
          @Override
          public void onConnectionSuspended(int i) {
  
          }
  
          @Override
          public void onConnectionFailed(ConnectionResult connectionResult) {
  
          }
      }
  </code></pre>
  
  <p>Here is my <a href="http://pastebin.com/fkN0JJmx" rel="nofollow noreferrer">AndroidManifest.xml</a></p>
  
  <p>Here is my map <a href="http://pastebin.com/Ww0S1Aed" rel="nofollow noreferrer">Fragment</a></p>
  
  <p>I have followed indtructions from <a href="https://developers.google.com/places/android/" rel="nofollow noreferrer">Google Places API for Android</a></p>
  
  <p>And I have tried accepted answer of this question:
  <a href="https://stackoverflow.com/questions/8428209/show-current-location-and-nearby-places-and-route-between-two-places-using-googl">Show Current Location and Nearby Places and Route between two places using Google Maps API in Android</a></p>
  
  <hr>
  
  <h2>UPDATE</h2>
  
  <p>I have enabled other map related APIs from Google Developer Console and it worked.</p>