**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).

> [!NOTE]
> This product is in [Legacy status](https://developers.google.com/maps/legacy.md.txt). As of October 2026, Places API (Legacy) can no longer be enabled for new Google Cloud projects. Existing projects remain fully supported. For new features and improved performance, [migrate
> to Places API (New)](https://developers.google.com/maps/documentation/places/android-sdk/legacy/migrate-overview).

You can use the Places SDK for Android (Legacy) to request a place photo to
display in your application. Photos returned by the photos service come from a
variety of sources, including business owners and user-contributed photos.

Places SDK for Android (Legacy) returns a bitmap image with a maximum
size of 1600 by 1600 pixels.

## Photo retrieval process

To retrieve an image for a place:

1. Use [Place Details (Legacy)](https://developers.google.com/maps/documentation/places/android-sdk/legacy/place-details.md.txt) to fetch a `Place` object (using [`fetchPlace()`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/net/PlacesClient#fetchPlace(com.google.android.libraries.places.api.net.FetchPlaceRequest))). Be sure to include the `Place.Field PHOTO_METADATAS` field in the list of fields to include in the response `Place` object.
2. In the [`OnSuccessListener`](https://developer.android.com/reference/com/google/android/play/core/tasks/OnSuccessListener) for your [`FetchPlaceResponse`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/net/FetchPlaceResponse), use [`Place.getPhotoMetadas()`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/Place#getPhotoMetadatas()) to get the photo metadata object, of type [`PhotoMetadata`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/PhotoMetadata) from the response `Place` object.
3. Create a [`FetchPhotoRequest`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/net/FetchPhotoRequest) object, optionally specifying maximum height and width (in pixels). Photos can have a maximum width or height of 1600px.
4. Use [`PlacesClient.fetchPhoto()`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/net/PlacesClient#fetchPhoto(com.google.android.libraries.places.api.net.FetchPhotoRequest)) to request the photo bitmap.
5. Add an `OnSuccessListener` and get the photo from the [`FetchPhotoResponse`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/net/FetchPhotoResponse).

## Get a photo

The following example demonstrates getting a place photo:

### Kotlin

```kotlin
// Define a Place ID.
val placeId = PlaceIdProvider.getRandomPlaceId()

// Specify fields. Requests for photos must always have the PHOTO_METADATAS field.
val fields = listOf(Place.Field.PHOTO_METADATAS)

// Get a Place object (this example uses fetchPlace(), but you can also use findCurrentPlace())
val placeRequest = FetchPlaceRequest.newInstance(placeId, fields)

placesClient.fetchPlace(placeRequest)
    .addOnSuccessListener { response: FetchPlaceResponse ->
        val place = response.place

        // Get the photo metadata.
        val metadata = place.photoMetadatas
        if (metadata == null || metadata.isEmpty()) {
            Log.w(TAG, "No photo metadata.")
            return@addOnSuccessListener
        }
        val photoMetadata = metadata.first()

        // Get the attribution text.
        val attributions = photoMetadata?.attributions

        binding.placePhotosAttributions.text = attributions

        // Create a FetchResolvedPhotoUriRequest.
        val photoRequest = FetchResolvedPhotoUriRequest.builder(photoMetadata)
            .setMaxWidth(500) // Optional.
            .setMaxHeight(300) // Optional.
            .build()
        placesClient.fetchResolvedPhotoUri(photoRequest)
            .addOnSuccessListener { fetchPhotoResponse ->
                val photoUri = fetchPhotoResponse.uri
                Glide.with(this)
                    .load(photoUri)
                    .into(binding.placePhotosResult)
            }.addOnFailureListener { exception: Exception ->
                if (exception is ApiException) {
                    Log.e(TAG, "Place not found: " + exception.message)
                    val statusCode = exception.statusCode
                    // TODO: Handle error with given status code.
                }
            }
    }

      
```

### Java

```java
// Define a Place ID.
final String placeId = PlaceIdProvider.getRandomPlaceId();

// Specify fields. Requests for photos must always have the PHOTO_METADATAS field.
final List<Place.Field> fields = Collections.singletonList(Place.Field.PHOTO_METADATAS);

// Get a Place object (this example uses fetchPlace(), but you can also use
// findCurrentPlace())
final FetchPlaceRequest placeRequest = FetchPlaceRequest.newInstance(placeId, fields);

placesClient
        .fetchPlace(placeRequest)
        .addOnSuccessListener(
                (response) -> {
                    final Place place = response.getPlace();

                    // Get the photo metadata.
                    final List<PhotoMetadata> metadata = place.getPhotoMetadatas();
                    if (metadata == null || metadata.isEmpty()) {
                        Log.w(TAG, "No photo metadata.");
                        return;
                    }
                    final PhotoMetadata photoMetadata = metadata.get(0);

                    // Get the attribution text.
                    final String attributions = photoMetadata.getAttributions();
                    binding.placePhotosAttributions.setText(attributions);

                    // Create a FetchResolvedPhotoUriRequest.
                    final FetchResolvedPhotoUriRequest photoRequest =
                            FetchResolvedPhotoUriRequest.builder(photoMetadata)
                                    .setMaxWidth(500) // Optional.
                                    .setMaxHeight(300) // Optional.
                                    .build();
                    placesClient
                            .fetchResolvedPhotoUri(photoRequest)
                            .addOnSuccessListener(
                                    (fetchPhotoResponse) -> {
                                        Glide.with(this)
                                                .load(fetchPhotoResponse.getUri())
                                                .into(binding.placePhotosResult);
                                    })
                            .addOnFailureListener(
                                    (exception) -> {
                                        if (exception instanceof ApiException) {
                                            ApiException apiException =
                                                    (ApiException) exception;
                                            Log.e(
                                                    TAG,
                                                    "Place not found: "
                                                            + exception.getMessage());
                                            final int statusCode =
                                                    apiException.getStatusCode();
                                            // TODO: Handle error with given status code.
                                        }
                                    });
                });

      
```

> [!NOTE]
> **Note:** For more information on initializing `PlacesClient`, see [Initialize the Places API client](https://developers.google.com/maps/documentation/places/android-sdk/config.md.txt#connect-client).

> [!NOTE]
> You can use a [CancellationToken](https://developers.google.com/android/reference/com/google/android/gms/tasks/CancellationToken.md.txt)
> to attempt to cancel a request to any of the request classes (for example,
> `FetchPlaceRequest`). Cancellation is done on a best-effort basis.
> Once a cancellation request is issued, no response will be returned.
> **Issuing a cancellation token does NOT guarantee that a particular request
> will be cancelled, and you may still be charged for the request even if no
> response is returned**.

## Attributions

In most cases, place photos can be used without attribution, or will have
the required attribution included as part of the image. However, the photo metadata object, of type
[`PhotoMetadata`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/PhotoMetadata),
can contain either of two types of additional attributions:

- **Attributions** , an attribution string accessed by [`PhotoMetadata.getAttributions()`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/PhotoMetadata#public-abstract-string-getattributions).
- **AuthorAttributions** , an [`AuthorAttributions`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/AuthorAttributions) object accessed by [`PhotoMetadata.getAuthorAttributions()`](https://developers.google.com/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/PhotoMetadata#public-abstract-authorattributions-getauthorattributions).

If the returned `PhotoMetadata` object includes either type of attribution, you must
include the attribution in your application wherever you display the image. For more information,
see [Displaying Attributions](https://developers.google.com/maps/documentation/places/android-sdk/legacy/attributions#photos).

## Usage and billing

A **Place Photos (Legacy)** SKU is charged for calls to `fetchPhoto()`.
See the [Usage and Billing](https://developers.google.com/maps/documentation/places/android-sdk/legacy/usage-and-billing#places-photo-legacy-ent-sku) page for details.