PlacePhotoMetadata
Stay organized with collections
Save and categorize content based on your preferences.
This interface is deprecated.
The Google Play Services Places SDK is deprecated. A new SDK is available.
See the client
migration guide for more information.
The metadata corresponding to a single photo associated with a place.
Inherited Method Summary
From interface
com.google.android.gms.common.data.Freezable
Public Methods
public abstract CharSequence
getAttributions ()
Returns the attributions that must be shown to the user if this photo is
displayed.
See Displaying
Attributions for more details.
Returns
- The attributions in HTML format, or null if there are none.
public abstract int getMaxHeight ()
Returns the maximum height in which this photo is available.
Returns
- The maximum height in pixels.
public abstract int getMaxWidth ()
Returns the maximum width in which this photo is available.
Returns
- The maximum width in pixels.
Retrieves the image data for this photo at its maximum size.
The photos service may cache the image data. If the requested photo does not exist
in the cache then a network lookup will be performed.
Access to this method is subject to quota restrictions. See Usage Limits for more details.
NOTE: When using a GeoDataClient
,
you should call
getPhoto(PlacePhotoMetadata)
rather than this method.
Returns
- A PendingResult including the result of the request and (if successful) a
Bitmap
of
the image data.
Retrieves the image data for this photo, scaled to fit the given dimensions.
The image will be scaled to match the smaller of the given dimensions whilst
maintaining the original aspect ratio. This scaling is performed server-side.
The photos service may cache the image data. If the requested photo does not exist
in the cache then a network lookup will be performed.
Access to this method is subject to quota restrictions. See Usage Limits for more details.
NOTE: When using a GeoDataClient
,
you should call
getScaledPhoto(PlacePhotoMetadata, int, int)
rather than this method.
Parameters
client |
|
width |
The desired maximum width in pixels. |
height |
The desired maximum height in pixels. |
Returns
- A PendingResult including the result of the request and (if successful) a
Bitmap
of
the image data.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003ePlacePhotoMetadata\u003c/code\u003e provides metadata about a photo associated with a place, including attributions, dimensions, and methods to retrieve the photo.\u003c/p\u003e\n"],["\u003cp\u003eThis interface is deprecated, as the Google Play Services Places SDK is being replaced with a new SDK.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve the photo at its maximum size or scaled to fit specific dimensions using \u003ccode\u003egetPhoto()\u003c/code\u003e and \u003ccode\u003egetScaledPhoto()\u003c/code\u003e respectively.\u003c/p\u003e\n"],["\u003cp\u003eWhen using \u003ccode\u003eGeoDataClient\u003c/code\u003e, alternative methods for retrieving photos are recommended.\u003c/p\u003e\n"],["\u003cp\u003eRemember to display attributions to the user when showing the photo, as per the guidelines.\u003c/p\u003e\n"]]],[],null,["# PlacePhotoMetadata\n\npublic interface **PlacePhotoMetadata** implements [Freezable](/android/reference/com/google/android/gms/common/data/Freezable)\\\u003c[PlacePhotoMetadata](/android/reference/com/google/android/gms/location/places/PlacePhotoMetadata)\\\u003e \n**This interface is deprecated.** \n\n**The Google Play Services Places SDK is deprecated.** A new SDK is available.\nSee the [client\nmigration guide](//developers.google.com/places/android-sdk/client-migration) for more information.\n\nThe metadata corresponding to a single photo associated with a place. \n\n### Public Method Summary\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html) | [getAttributions](/android/reference/com/google/android/gms/location/places/PlacePhotoMetadata#getAttributions())() Returns the attributions that must be shown to the user if this photo is displayed. |\n| abstract int | [getMaxHeight](/android/reference/com/google/android/gms/location/places/PlacePhotoMetadata#getMaxHeight())() Returns the maximum height in which this photo is available. |\n| abstract int | [getMaxWidth](/android/reference/com/google/android/gms/location/places/PlacePhotoMetadata#getMaxWidth())() Returns the maximum width in which this photo is available. |\n| abstract [PendingResult](/android/reference/com/google/android/gms/common/api/PendingResult)\\\u003c[PlacePhotoResult](/android/reference/com/google/android/gms/location/places/PlacePhotoResult)\\\u003e | [getPhoto](/android/reference/com/google/android/gms/location/places/PlacePhotoMetadata#getPhoto(com.google.android.gms.common.api.GoogleApiClient))([GoogleApiClient](/android/reference/com/google/android/gms/common/api/GoogleApiClient) client) Retrieves the image data for this photo at its maximum size. |\n| abstract [PendingResult](/android/reference/com/google/android/gms/common/api/PendingResult)\\\u003c[PlacePhotoResult](/android/reference/com/google/android/gms/location/places/PlacePhotoResult)\\\u003e | [getScaledPhoto](/android/reference/com/google/android/gms/location/places/PlacePhotoMetadata#getScaledPhoto(com.google.android.gms.common.api.GoogleApiClient, int, int))([GoogleApiClient](/android/reference/com/google/android/gms/common/api/GoogleApiClient) client, int width, int height) Retrieves the image data for this photo, scaled to fit the given dimensions. |\n\n### Inherited Method Summary\n\nFrom interface com.google.android.gms.common.data.Freezable \n\n|-------------------------------------------------------------------------------------------------------------|---------------|\n| abstract [PlacePhotoMetadata](/android/reference/com/google/android/gms/location/places/PlacePhotoMetadata) | freeze() |\n| abstract boolean | isDataValid() |\n\nPublic Methods\n--------------\n\n#### public abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html)\n**getAttributions** ()\n\nReturns the attributions that must be shown to the user if this photo is\ndisplayed.\n\nSee [Displaying\nAttributions](//developers.google.com/places/android/attributions#third-party) for more details. \n\n##### Returns\n\n- The attributions in HTML format, or null if there are none. \n\n#### public abstract int **getMaxHeight** ()\n\nReturns the maximum height in which this photo is available. \n\n##### Returns\n\n- The maximum height in pixels. \n\n#### public abstract int **getMaxWidth** ()\n\nReturns the maximum width in which this photo is available. \n\n##### Returns\n\n- The maximum width in pixels. \n\n#### public abstract [PendingResult](/android/reference/com/google/android/gms/common/api/PendingResult)\\\u003c[PlacePhotoResult](/android/reference/com/google/android/gms/location/places/PlacePhotoResult)\\\u003e\n**getPhoto** ([GoogleApiClient](/android/reference/com/google/android/gms/common/api/GoogleApiClient) client)\n\nRetrieves the image data for this photo at its maximum size.\n\nThe photos service may cache the image data. If the requested photo does not exist\nin the cache then a network lookup will be performed.\n\nAccess to this method is subject to quota restrictions. See [Usage Limits](//developers.google.com/places/android/usage) for more details.\n\nNOTE: When using a [GeoDataClient](/android/reference/com/google/android/gms/location/places/GeoDataClient),\nyou should call [getPhoto(PlacePhotoMetadata)](/android/reference/com/google/android/gms/location/places/GeoDataClient#getPhoto(com.google.android.gms.location.places.PlacePhotoMetadata)) rather than this method. \n\n##### Returns\n\n- A PendingResult including the result of the request and (if successful) a [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html) of the image data. \n\n#### public abstract [PendingResult](/android/reference/com/google/android/gms/common/api/PendingResult)\\\u003c[PlacePhotoResult](/android/reference/com/google/android/gms/location/places/PlacePhotoResult)\\\u003e\n**getScaledPhoto** ([GoogleApiClient](/android/reference/com/google/android/gms/common/api/GoogleApiClient) client, int width, int height)\n\nRetrieves the image data for this photo, scaled to fit the given dimensions.\n\nThe image will be scaled to match the smaller of the given dimensions whilst\nmaintaining the original aspect ratio. This scaling is performed server-side.\n\nThe photos service may cache the image data. If the requested photo does not exist\nin the cache then a network lookup will be performed.\n\nAccess to this method is subject to quota restrictions. See [Usage Limits](//developers.google.com/places/android/usage) for more details.\n\nNOTE: When using a [GeoDataClient](/android/reference/com/google/android/gms/location/places/GeoDataClient),\nyou should call [getScaledPhoto(PlacePhotoMetadata, int, int)](/android/reference/com/google/android/gms/location/places/GeoDataClient#getScaledPhoto(com.google.android.gms.location.places.PlacePhotoMetadata, int, int)) rather than this method. \n\n##### Parameters\n\n| client | |\n| width | The desired maximum width in pixels. |\n| height | The desired maximum height in pixels. |\n|--------|---------------------------------------|\n\n##### Returns\n\n- A PendingResult including the result of the request and (if successful) a [Bitmap](//developer.android.com/reference/android/graphics/Bitmap.html) of the image data. \n\n##### Throws\n\n| [IllegalArgumentException](//developer.android.com/reference/java/lang/IllegalArgumentException.html) | If either of the given width or height values are less than or equal to 0. |\n|-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|"]]