**European Economic Area (EEA) developers**

> [!NOTE]
> If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](https://developers.google.com/maps/comms/eea/faq.md.txt).

<br />

> [!NOTE]
> This feature requires that you enable Places API (New), the next generation of the Places API. For more information, see [Enable APIs](https://developers.google.com/maps/documentation/places/android-sdk/legacy/cloud-setup#enabling-apis).

<br />

Places SDK for Android (Legacy) supports [Current Place (Legacy)](https://developers.google.com/maps/documentation/places/android-sdk/legacy/current-place.md.txt). If you
are familiar with the Current Place (Legacy), [Nearby Search (New)](https://developers.google.com/maps/documentation/places/android-sdk/nearby-search.md.txt) makes the following
changes:

- Uses a new pricing model. For pricing information for all APIs, see [Places SDK for Android (New)](https://developers.google.com/maps/documentation/places/android-sdk/usage-and-billing.md.txt#pricing-new).

- You must initialize your app by calling the
  [`Places.initializeWithNewPlacesApiEnabled()`](https://developers.google.com/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places.md.txt#initializeWithNewPlacesApiEnabled(android.content.Context,%20java.lang.String))
  method. For more information on selecting the Places API service, see
  [Set up your Google Cloud project](https://developers.google.com/maps/documentation/places/android-sdk/legacy/cloud-setup).

- Field masking is required. You must specify which fields you want returned
  in the response. There is no default list of returned fields. If you omit
  this list, the methods return an error.

- Nearby Search (New) does not support
  [`PlaceLikelihood`](https://developers.google.com/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/PlaceLikelihood#inherited-methods).
  With Nearby Search (New), you can use the result order to determine the most
  likely location.

## Nearby Search (New) examples

For more information, as well as examples of how to use Nearby Search (New), see
the [Nearby Search (New)](https://developers.google.com/maps/documentation/places/android-sdk/nearby-search.md.txt)
documentation.

## Use Nearby Search (New) to get the current place

The following sample demonstrates how to get the current place with Nearby Search (New) by replacing the use of `PlacesClient.findCurrentPlace()` with
`PlacesClient.searchNearby()`:

```java
public class MainActivity extends AppCompatActivity {

  private FusedLocationProviderClient fusedLocationProviderClient;

  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    // ...

    // get permission
    if (ContextCompat.checkSelfPermission(this,
        Manifest.permission.ACCESS_FINE_LOCATION)
        == PackageManager.PERMISSION_GRANTED) {

      // get location and search
      fusedLocationProviderClient
        .getLastLocation()
        .addOnSuccessListener(
            this,
            location -> {
              if (location != null) {
                LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
                CircularBounds circle = CircularBounds.newInstance(latLng, 100);
                List<Place.Field> placeFields = Arrays.asList(Place.Field.ID, Place.Field.DISPLAY_NAME);

                // Define a list of types to exclude. Adjust this list to suit each application.
                final List<String> excludedTypes = Arrays.asList("public_bathroom", "beach");

                SearchNearbyRequest request
                        = SearchNearbyRequest.builder(/* location restriction = */ circle, placeFields)
                                .setExcludedTypes(excludedTypes)
                                .setRankPreference(SearchNearbyRequest.RankPreference.DISTANCE)
                                .build();

                placesClient
                    .searchNearby(request)
                    .addOnSuccessListener(
                        response -> {
                            List<Place> places = response.getPlaces();
                            // do more on the results
                        })
                    .addOnFailureListener(
                        exception -> {
                            // handle failure
                        });
              } else {
                // failed to get location.
              }
            })
        .addOnFailureListener(
            e -> {
              // handle error
            });

    } else {
      ActivityCompat.requestPermissions(
          this,
          new String[] {Manifest.permission.ACCESS_FINE_LOCATION},
          PERMISSION_REQUEST_CODE);
    }

  }
}
```