Migrate to Place Details (New)

Places SDK for Android supports the existing Place Details. If you are familiar with the existing Places SDK for Android, the new version of Place Details makes the following changes:

The following sections describe additional changes.

Access new place types

Each place can have one or more type values associated with it. The Places SDK for Android version 3.3.0 and later adds many new type values. For the complete list, see Expanded place types.

The Place.getPlaceTypes() method returns the type values as a list of string values. The values returned depend on your version of the Places SDK for Android:

  • Places SDK for Android (New): Returns the strings defined by Table A and Table B shown on Place Types (New), including all the added place types added in version 3.3.0.

  • Places SDK for Android: Returns the enums defined by Place.Types, which does not include the new types added in version 3.3.0 and later.

Access place reviews

The Places SDK for Android (New) adds the Review class, which contains a review of a place. The Place object can contain up to five reviews.

The Review class can also contain an attribution and an author attribution. If you display the review in your app, then you must also display any attribution or author attribution. For more information, see Display a review.

For more information, see the documentation on attributions.

Access place name language code

The existing Place.getName() method returns a text string containing the name of a place. To populate the Place object with the place name, you must include the Place.Field.NAME in the field list of the place details request.

The Place object now contains the language code for the name string. To populate the Place object with language code, you must:

  1. Include the Place.Field.NAME in the field list of the request. This value configures response to include both the place name and language code in the Place object.

  2. Call PlacesClient.fetchPlace(). PlacesClient.findCurrentPlace() does not support the language code field.

  3. Use the Place.getNameLanguageCode() method to access the language code field in the Place object.

Set region code

Places SDK for Android (New) adds the region code request parameter to Place Details. The region code is used to format the response, specified as a two-character CLDR code value. This parameter can also have a bias effect on the search results. There is no default value. You must enable the new SDK to set the region code.

If the country name of the address field in the response matches the region code, the country code is omitted from 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.

Example request

For a complete example, see Place Details (New).