AI-generated Key Takeaways
- 
          Request detailed information about a place using its Place ID and the Place Details (New) feature in the Places SDK for Android (version 3.3.0 or later). 
- 
          Obtain a place ID through Text Search, Nearby Search, or Autocomplete. 
- 
          Construct a FetchPlaceRequestwith the place ID and a field list specifying the desired data, then usePlacesClient.fetchPlace()to retrieve the details.
- 
          Place Details (New) returns a Placeobject containing the requested fields, allowing access to data like address, phone number, ratings, and reviews.
- 
          Tailor your requests by using optional parameters like region code and session token for customized results and billing management. 
You can request more details about a particular establishment or point of interest by using its place ID and making a Place Details (New) request. Place Details (New) returns more comprehensive information about the indicated place, such as its complete address, phone number, user rating and reviews.
There are many ways to obtain a place ID. You can use:
Place Details (New) requests
You can request place details by calling
PlacesClient.fetchPlace()
and passing a
FetchPlaceRequest
object containing a place ID and field list, as well
as any optional parameters:
// Define a place ID.
final String placeId = "INSERT_PLACE_ID_HERE";
// Specify the list of fields to return.
final List<Place.Field> placeFields = Arrays.asList("INSERT_PLACE_FIELDS_HERE");
// Construct a request object, passing the place ID and field list.
final FetchPlaceRequest request = FetchPlaceRequest.newInstance(placeId, placeFields);
// Pass the request object and make the request
Task<FetchPlaceResponse> placeTask = placesClient.fetchPlace(request);
Place Details (New) responses
Place Details (New) returns data in the form of a
Place
object, which includes only the fields that you requested using the field
list. Place data results cannot be empty, so only place results
with data are returned (for example, if a requested place has no photos, the
photos field won't be present in the result).
To access data fields, call the corresponding
method.
For example, to access the place name, call getName().
Required parameters
The required parameters for
FetchPlaceRequest
are:
- 
    Place IDA textual identifier that uniquely identifies a place, returned from a Text Search (New), Nearby Search (New), or Autocomplete (New). For more information about place IDs, see the place ID overview. 
- 
    Field listWhen you request a place, you must specify which place data to return. To do this, pass a list of Place.Fieldvalues specifying the data to return. There is no default list of returned fields in the response.Field lists are a good design practice to ensure that you don't request unnecessary data, which helps to avoid unnecessary processing time and billing charges.This list is an important consideration because it affects the cost for each request. For more information, see Usage and Billing. Specify one or more of the following fields: - The following fields trigger the Place Details Essentials IDs Only SKU: - Place.Field.ID
 - Place.Field.PHOTO_METADATAS
 - Place.Field.RESOURCE_NAME
 
- The following fields trigger the Place Details Essentials SKU: - Place.Field.ADDRESS_COMPONENTS
 - ADR_FORMAT_ADDRESS
 - Place.Field.FORMATTED_ADDRESS*
 * Use instead of- Place.Field.ADDRESS(deprecated).
 - Place.Field.LOCATION*
 * Use instead of- Place.Field.LAT_LNG(deprecated).
 - Place.Field.PLUS_CODE
 - Place.Field.SHORT_FORMATTED_ADDRESS
 - Place.Field.TYPES
 - Place.Field.VIEWPORT
- The following fields trigger the Place Details Pro SKU: - Place.Field.ACCESSIBILITY_OPTIONS*
 * Use instead of- Place.Field.WHEELCHAIR_ACCESSIBLE_ENTRANCE(deprecated).
 - Place.Field.BUSINESS_STATUS
 - Place.Field.DISPLAY_NAME*
 * Use instead of- Place.Field.NAME, which is deprecated.
 - Place.Field.GOOGLE_MAPS_URI
 - Place.Field.ICON_BACKGROUND_COLOR
 - Place.Field.ICON_MASK_URL*
 * Use instead of- Place.Field.ICON_URL(deprecated).
 - Place.Field.PRIMARY_TYPE
 - Place.Field.PRIMARY_TYPE_DISPLAY_NAME
 - Place.Field.SUB_DESTINATIONS
 - Place.Field.UTC_OFFSET
- The following fields trigger the Place Details Enterprise SKU: - Place.Field.CURRENT_OPENING_HOURS
 - Place.Field.CURRENT_SECONDARY_OPENING_HOURS
 - Place.Field.INTERNATIONAL_PHONE_NUMBER*
 * Use instead of- Place.Field.PHONE_NUMBER, which is deprecated.
 - Place.Field.NATIONAL_PHONE_NUMBER
 - Place.Field.OPENING_HOURS
 - Place.Field.PRICE_LEVEL
 - Place.Field.RATING
 - Place.Field.SECONDARY_OPENING_HOURS
 - Place.Field.USER_RATING_COUNT*
 * Use instead of- Place.Field.USER_RATINGS_TOTAL, which is deprecated.
 - Place.Field.WEBSITE_URI
- The following fields trigger the Place Details Enterprise Plus SKU: - Place.Field.ALLOWS_DOGS
 - Place.Field.CURBSIDE_PICKUP
 - Place.Field.DELIVERY
 - Place.Field.DINE_IN
 - Place.Field.EDITORIAL_SUMMARY
 - Place.Field.EV_CHARGE_OPTIONS
 - Place.Field.FUEL_OPTIONS
 - Place.Field.GOOD_FOR_CHILDREN
 - Place.Field.GOOD_FOR_GROUPS
 - Place.Field.GOOD_FOR_WATCHING_SPORTS
 - Place.Field.LIVE_MUSIC
 - Place.Field.MENU_FOR_CHILDREN
 - Place.Field.OUTDOOR_SEATING
 - Place.Field.PARKING_OPTIONS
 - Place.Field.PAYMENT_OPTIONS
 - Place.Field.RESERVABLE
 - Place.Field.RESTROOM
 - Place.Field.REVIEWS
 - Place.Field.SERVES_BEER
 - Place.Field.SERVES_BREAKFAST
 - Place.Field.SERVES_BRUNCH
 - Place.Field.SERVES_COCKTAILS
 - Place.Field.SERVES_COFFEE
 - Place.Field.SERVES_DESSERT
 - Place.Field.SERVES_DINNER
 - Place.Field.SERVES_LUNCH
 - Place.Field.SERVES_VEGETARIAN_FOOD
 - Place.Field.SERVES_WINE
 - Place.Field.TAKEOUT
 
Optional parameters
The optional parameters for
FetchPlaceRequest
are:
- Region code- The region code used to format the response, specified as a two-character CLDR code value. There is no default value. - If the country name of the - Place.Field.FORMATTED_ADDRESSfield in the response matches the- regionCode, the country code is omitted from- Place.Field.FORMATTED_ADDRESS.- Most CLDR codes are identical to ISO 3166-1 codes, with some notable exceptions. For example, the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is "gb" (technically for the entity of "The United Kingdom of Great Britain and Northern Ireland"). The parameter can affect results based on applicable law. - To set the region code parameter, call the - setRegionCode()method when building the- FetchPlaceRequestobject.
- 
    Session tokenSession tokens are user-generated strings that track Autocomplete (New) calls as "sessions." Autocomplete (New) uses session tokens to group the query and place selection phases of a user autocomplete search into a discrete session for billing purposes. Session tokens are passed into Place Details (New) calls that follow Autocomplete (New) calls. For more information, see Session tokens. To set the session token parameter, call the setSessionToken()method when building theFetchPlaceRequestobject.
Place Details example
The following example requests the ID, DISPLAY_NAME, and FORMATTED_ADDRESS
fields for the Empire State Building in New York City.
// Define a place ID.
final String placeId = "ChIJaXQRs6lZwokRY6EFpJnhNNE";
// Specify the list of fields to return.
final List<Place.Field> placeFields = Arrays.asList(Place.Field.ID, Place.Field.DISPLAY_NAME, Place.Field.FORMATTED_ADDRESS);
// Construct a request object, passing the place ID and field list.
final FetchPlaceRequest request = FetchPlaceRequest.newInstance(placeId, placeFields);
// Pass the request object and make the request
Task<FetchPlaceResponse> placeTask = placesClient.fetchPlace(request);