Represents a particular physical place.
A Place encapsulates information about a physical location, including its name, address, and any other information we might have about it.
Note: In general, some fields will be inapplicable to certain places, or the information may not exist.
Nested Class Summary
enum | Place.BooleanPlaceAttributeValue | Value of the place attribute field. | |
class | Place.Builder | Builder for Place . |
|
enum | Place.BusinessStatus | The business status of a place. | |
enum | Place.Field | Use the values of Place.Field to specify which place data types to return. | |
enum | Place.Type |
This enum is deprecated.
Use Place.getPlaceTypes() instead.
|
Constant Summary
int | PRICE_LEVEL_MAX_VALUE | The highest price level possible, for example, very expensive. |
int | PRICE_LEVEL_MIN_VALUE | The lowest price level possible. |
double | RATING_MAX_VALUE | The highest rating possible, for example, very good. |
double | RATING_MIN_VALUE | The lowest rating possible, for example, very bad. |
Inherited Constant Summary
Public Constructor Summary
Place()
|
Public Method Summary
static Place.Builder |
builder()
Returns a
Place.Builder . |
abstract String |
getAddress()
Returns a human-readable address for this Place.
|
abstract AddressComponents |
getAddressComponents()
Returns the address components for this Place's location.
|
abstract List<String> |
getAttributions()
Returns the attributions that must be shown to the user, if data from the Place is used.
|
abstract Place.BusinessStatus |
getBusinessStatus()
Returns the
Place.BusinessStatus for this Place. |
abstract Place.BooleanPlaceAttributeValue |
getCurbsidePickup()
Returns the
Place.BooleanPlaceAttributeValue for curbside pickup. |
abstract OpeningHours |
getCurrentOpeningHours()
Returns this Place's hours of operation over the next seven days.
|
abstract Place.BooleanPlaceAttributeValue |
getDelivery()
Returns the
Place.BooleanPlaceAttributeValue for delivery. |
abstract Place.BooleanPlaceAttributeValue |
getDineIn()
Returns the
Place.BooleanPlaceAttributeValue for indoor or outdoor seating options. |
abstract String |
getEditorialSummary()
Returns a medium-length (150 characters max) textual summary of the place.
|
abstract String |
getEditorialSummaryLanguageCode()
Returns the editorial summary's language code, if available.
|
abstract Integer |
getIconBackgroundColor()
Returns the
@ColorInt of the icon background color. |
abstract String |
getIconUrl()
Returns the icon PNG URL string to the Places's type.
|
abstract String |
getId()
Returns the unique ID of this Place.
|
abstract LatLng |
getLatLng()
Returns the location of this Place.
|
abstract String |
getName()
Returns the name of this Place.
|
abstract String |
getNameLanguageCode()
Returns the name's language code, if available.
|
abstract OpeningHours |
getOpeningHours()
Returns this Place's normal business hours.
|
abstract String |
getPhoneNumber()
Returns the place's phone number in international format.
|
abstract List<PhotoMetadata> |
getPhotoMetadatas()
Returns the metadata for a photo associated with a place.
|
abstract List<String> |
getPlaceTypes()
Returns a list of place types for this Place.
|
abstract PlusCode |
getPlusCode()
Returns the
PlusCode location of this Place. |
abstract Integer |
getPriceLevel()
Returns the price level for this place on a scale from
PRICE_LEVEL_MIN_VALUE to PRICE_LEVEL_MAX_VALUE . |
abstract String |
getPrimaryType()
Returns the primary place type for this Place.
|
abstract Double |
getRating()
Returns the place's rating, from
RATING_MIN_VALUE to RATING_MAX_VALUE , based
on aggregated user reviews. |
abstract Place.BooleanPlaceAttributeValue |
getReservable()
Returns the
Place.BooleanPlaceAttributeValue for reservations. |
abstract List<Review> |
getReviews()
Returns up to five reviews associated with a place.
|
abstract List<OpeningHours> |
getSecondaryOpeningHours()
Returns this Place's secondary hours of operation(s).
|
abstract Place.BooleanPlaceAttributeValue |
getServesBeer()
Returns the
Place.BooleanPlaceAttributeValue for serving beer. |
abstract Place.BooleanPlaceAttributeValue |
getServesBreakfast()
Returns the
Place.BooleanPlaceAttributeValue for serving breakfast. |
abstract Place.BooleanPlaceAttributeValue |
getServesBrunch()
Returns the
Place.BooleanPlaceAttributeValue for serving brunch. |
abstract Place.BooleanPlaceAttributeValue |
getServesDinner()
Returns the
Place.BooleanPlaceAttributeValue for serving dinner. |
abstract Place.BooleanPlaceAttributeValue |
getServesLunch()
Returns the
Place.BooleanPlaceAttributeValue for serving lunch. |
abstract Place.BooleanPlaceAttributeValue |
getServesVegetarianFood()
Returns the
Place.BooleanPlaceAttributeValue for serving vegetarian food. |
abstract Place.BooleanPlaceAttributeValue |
getServesWine()
Returns the
Place.BooleanPlaceAttributeValue for serving wine. |
abstract Place.BooleanPlaceAttributeValue |
getTakeout()
Returns the
Place.BooleanPlaceAttributeValue for takeout service. |
abstract List<Place.Type> |
getTypes()
This method is deprecated.
Use
getPlaceTypes() instead.
|
abstract Integer |
getUserRatingsTotal()
Returns the total number of user ratings of this Place.
|
abstract Integer |
getUtcOffsetMinutes()
Returns the number of minutes this place’s current timezone is offset from UTC.
|
abstract LatLngBounds |
getViewport()
Returns a viewport for displaying this Place.
|
abstract Uri |
getWebsiteUri()
Returns the URI of the website of this Place.
|
abstract Place.BooleanPlaceAttributeValue |
getWheelchairAccessibleEntrance()
Returns the
Place.BooleanPlaceAttributeValue for a wheelchair accessible entrance. |
Boolean |
isOpen(long utcTimeMillis)
This method is deprecated.
Use
PlacesClient.isOpen(IsOpenRequest)
instead.
|
Boolean |
isOpen()
This method is deprecated.
Use
PlacesClient.isOpen(IsOpenRequest)
instead.
|
Inherited Method Summary
Constants
public static final int PRICE_LEVEL_MAX_VALUE
The highest price level possible, for example, very expensive. See getPriceLevel()
for
more information.
public static final int PRICE_LEVEL_MIN_VALUE
The lowest price level possible. This denotes that a place is free. See getPriceLevel()
for more information.
public static final double RATING_MAX_VALUE
The highest rating possible, for example, very good. See getRating()
for more
information.
public static final double RATING_MIN_VALUE
The lowest rating possible, for example, very bad. See getRating()
for more
information.
Public Constructors
public Place ()
Public Methods
public abstract String getAddress ()
Returns a human-readable address for this Place. May return null if the address is unknown.
The address is localized according to the locale specified in Places.initialize(android.content.Context, String, java.util.Locale)
if set; otherwise it uses the device's locale.
public abstract AddressComponents getAddressComponents ()
Returns the address components for this Place's location.
The address is localized according to the locale specified in Places.initialize(android.content.Context, String, java.util.Locale)
if set; otherwise it uses the device's locale.
public abstract List<String> getAttributions ()
Returns the attributions that must be shown to the user, if data from the Place is used.
We recommend placing this information below any other Place data. See Displaying Attributions for more details.
This list should not be modified.
Returns
- The attributions in HTML format, or null if there are no attributions to display.
public abstract Place.BusinessStatus getBusinessStatus ()
Returns the Place.BusinessStatus
for this Place.
public abstract Place.BooleanPlaceAttributeValue getCurbsidePickup ()
Returns the Place.BooleanPlaceAttributeValue
for curbside pickup.
public abstract OpeningHours getCurrentOpeningHours ()
Returns this Place's hours of operation over the next seven days.
The time period starts at midnight on the date of the request and ends at 11:59 pm six days later.
public abstract Place.BooleanPlaceAttributeValue getDelivery ()
Returns the Place.BooleanPlaceAttributeValue
for delivery.
public abstract Place.BooleanPlaceAttributeValue getDineIn ()
Returns the Place.BooleanPlaceAttributeValue
for indoor or outdoor seating options.
public abstract String getEditorialSummary ()
Returns a medium-length (150 characters max) textual summary of the place.
public abstract String getEditorialSummaryLanguageCode ()
Returns the editorial summary's language code, if available.
public abstract Integer getIconBackgroundColor ()
Returns the @ColorInt
of the icon background color. Returns null if not available.
The background color is according to the Place's type. It can be used to color the view behind the icon.
public abstract String getIconUrl ()
Returns the icon PNG URL string to the Places's type. Returns null if not available.
The URL link does not expire and the image size aspect ratio may be different depending on type.
public abstract String getId ()
Returns the unique ID of this Place.
This ID can be defined in a FetchPlaceRequest
, which may be used in PlacesClient.fetchPlace(com.google.android.libraries.places.api.net.FetchPlaceRequest)
to look up the same place at a later time. Place ID data is constantly changing, so it is
possible for subsequent requests using the same ID to fail (for example, if the place no longer
exists in the database). A returned Place may also have a different ID from the ID specified in
the request, as there may be multiple IDs for a given place.
public abstract LatLng getLatLng ()
Returns the location of this Place.
The location is not necessarily the center of the Place, or any particular entry or exit point, but some arbitrarily chosen point within the geographic extent of the Place.
public abstract String getName ()
Returns the name of this Place.
The name is localized according to the locale specified in Places.initialize(android.content.Context, String, java.util.Locale)
if set; otherwise it uses the device's locale.
If neither locale is available, a default locale set by the places service will be used.
public abstract String getNameLanguageCode ()
Returns the name's language code, if available.
The language code of name field is only supported by Places API (New). Please enable your API key for the Places API (New) in the Google Cloud Console to access the data.
public abstract String getPhoneNumber ()
Returns the place's phone number in international format. Returns null if no phone number is known, or the place has no phone number.
International format includes the country code, and is prefixed with the plus (+) sign. For example, the international phone number for Google's Mountain View, USA office is +1 650-253-0000.
public abstract List<PhotoMetadata> getPhotoMetadatas ()
Returns the metadata for a photo associated with a place.
Photos are sourced from a variety of locations, including business owners and photos
contributed by Google+ users. In most cases, these photos can be used without attribution, or
will have the required attribution included as a part of the image. However, you must call
PhotoMetadata.getAttributions()
to retrieve any additional attributions required, and
display those attributions in your application wherever you display the image. For more
information, see the developer's
guide.
This list should not be modified.
public abstract List<String> getPlaceTypes ()
Returns a list of place types for this Place.
The returned list is based on which API version you are using.
If you enable Places API (New), then the list is the new Table A and B
If you enable Places API, then the list is the old Table 1 and 2
public abstract PlusCode getPlusCode ()
Returns the PlusCode
location of this Place.
The location is not necessarily the center of the Place, or any particular entry or exit point, but some arbitrarily chosen point within the geographic extent of the Place.
public abstract Integer getPriceLevel ()
Returns the price level for this place on a scale from PRICE_LEVEL_MIN_VALUE
to PRICE_LEVEL_MAX_VALUE
.
If no price level is known, null is returned.
The exact amount indicated by a specific value will vary from region to region, though a
value of PRICE_LEVEL_MIN_VALUE
always denotes that this place is free.
public abstract String getPrimaryType ()
Returns the primary place type for this Place.
A place can only have a single primary type. For the complete list of possible values, see Table A and B
The primary type field is only supported by Places API (New). Please enable your API key for the Places API (New) in the Google Cloud Console to access the data.
public abstract Double getRating ()
Returns the place's rating, from RATING_MIN_VALUE
to RATING_MAX_VALUE
, based
on aggregated user reviews.
If no rating is known, null is returned.
public abstract Place.BooleanPlaceAttributeValue getReservable ()
Returns the Place.BooleanPlaceAttributeValue
for reservations.
public abstract List<Review> getReviews ()
Returns up to five reviews associated with a place.
The reviews field is only supported by Places API (New). Please enable your API key for the Places API (New) in the Google Cloud Console to access the data. Google recommends that you display how reviews are being sorted to the end user. The default is to sort the reviews by relevance. For the new APIs, sorting by relevance is the only option.
public abstract List<OpeningHours> getSecondaryOpeningHours ()
Returns this Place's secondary hours of operation(s).
The returned type of secondary hours of operation(s) is based on which API version you are using.
If you enable Places API (New), it returns this Place's normal secondary hours of operation(s).
If you enable Places API, it returns this Place's secondary hours of operation(s) over the next seven days.
Secondary hours are different from a business's main hours. For example, a restaurant can
specify drive through hours or delivery hours as secondary hours. See OpeningHours.HoursType
for the different types of secondary hours.
public abstract Place.BooleanPlaceAttributeValue getServesBeer ()
Returns the Place.BooleanPlaceAttributeValue
for serving beer.
public abstract Place.BooleanPlaceAttributeValue getServesBreakfast ()
Returns the Place.BooleanPlaceAttributeValue
for serving breakfast.
public abstract Place.BooleanPlaceAttributeValue getServesBrunch ()
Returns the Place.BooleanPlaceAttributeValue
for serving brunch.
public abstract Place.BooleanPlaceAttributeValue getServesDinner ()
Returns the Place.BooleanPlaceAttributeValue
for serving dinner.
public abstract Place.BooleanPlaceAttributeValue getServesLunch ()
Returns the Place.BooleanPlaceAttributeValue
for serving lunch.
public abstract Place.BooleanPlaceAttributeValue getServesVegetarianFood ()
Returns the Place.BooleanPlaceAttributeValue
for serving vegetarian food.
public abstract Place.BooleanPlaceAttributeValue getServesWine ()
Returns the Place.BooleanPlaceAttributeValue
for serving wine.
public abstract Place.BooleanPlaceAttributeValue getTakeout ()
Returns the Place.BooleanPlaceAttributeValue
for takeout service.
public abstract List<Place.Type> getTypes ()
This method is deprecated.
Use getPlaceTypes()
instead.
Returns a list of place types for this Place.
The elements of this list are drawn from Place.TYPE_*
constants, though one should
expect there could be new place types returned that were introduced after an app was published.
This list should not be modified.
public abstract Integer getUserRatingsTotal ()
Returns the total number of user ratings of this Place. Returns null if the number of user ratings is not known.
public abstract Integer getUtcOffsetMinutes ()
Returns the number of minutes this place’s current timezone is offset from UTC.
public abstract LatLngBounds getViewport ()
Returns a viewport for displaying this Place. May return null if the size of the place is not known.
This returns a viewport of a size that is suitable for displaying this Place. For example, a Place representing a store may have a relatively small viewport, while a Place representing a country may have a very large viewport.
public abstract Uri getWebsiteUri ()
Returns the URI of the website of this Place. Returns null if no website is known.
This is the URI of the website maintained by the Place, if available. This link is always for a third-party website not affiliated with the Places API.
public abstract Place.BooleanPlaceAttributeValue getWheelchairAccessibleEntrance ()
Returns the Place.BooleanPlaceAttributeValue
for a wheelchair accessible entrance.
public Boolean isOpen (long utcTimeMillis)
This method is deprecated.
Use PlacesClient.isOpen(IsOpenRequest)
instead.
Calculates if the place is open at utcTimeMillis
.
To ensure accurate results, Place.Field.UTC_OFFSET
and Place.Field.BUSINESS_STATUS
must
be requested when using PlacesClient.findCurrentPlace(FindCurrentPlaceRequest)
or PlacesClient.fetchPlace(FetchPlaceRequest)
. If Place.Field.BUSINESS_STATUS
is not requested, it is assumed that the business is operational.
Parameters
utcTimeMillis | the milliseconds from 1970-01-01T00:00:00Z. |
---|
Returns
- whether the place is open at
utcTimeMillis
. Returns null if thePlace
'sOpeningHours.getPeriods()
is null orgetUtcOffsetMinutes()
is null.
public Boolean isOpen ()
This method is deprecated.
Use PlacesClient.isOpen(IsOpenRequest)
instead.
Calculates if the place is open at the device's current time.
To ensure accurate results, Place.Field.UTC_OFFSET
and Place.Field.BUSINESS_STATUS
must
be requested when using PlacesClient.findCurrentPlace(FindCurrentPlaceRequest)
or PlacesClient.fetchPlace(FetchPlaceRequest)
. If Place.Field.BUSINESS_STATUS
is not requested, it is assumed that the business is operational.
Returns
- whether the place is open at the device's current time. Returns null if the
Place
'sOpeningHours.getPeriods()
is null orgetUtcOffsetMinutes()
is null.