AdsApp.Media
Stay organized with collections
Save and categorize content based on your preferences.
A Google Ads media object.
Methods:
Member Type Description
getDimensions
void
getEntityType
String
Returns the type of this entity as a String
, in this case,
"Media"
.
getFileSize
long
Returns the size of the media file in bytes.
getId
String
Returns the ID of the media.
getMimeType
String
Returns a MIME type identifier for the media object.
getName
String
Returns the name of the media object, or null
if the media was
created without a name.
getReferenceId
void
getResourceName
String
Returns the resource name of the media.
getSourceUrl
String
Returns the URL where the original media was downloaded from, or
null
if the media was not obtained via download.
getType
String
Returns the media object's type.
getUrls
AdsApp.MediaUrls
Returns a MediaUrls instance for the
media object if it is an image.
getYouTubeVideoId
String
Returns the YouTube video ID if this media is a YouTube video, or
null
otherwise.
getDimensions()
Deprecated. This method will throw an error.
Returns nothing.
getEntityType()
Returns the type of this entity as a
String
, in this case,
"Media"
.
Return values:
Type Description
String
Type of this entity: "Media"
.
getFileSize()
Returns the size of the media file in bytes.
Return values:
Type Description
long
The file size.
getId()
Returns the ID of the media.
Return values:
Type Description
String
The ID of the media.
getMimeType()
Returns a MIME type identifier for the media object.
For example, this returns IMAGE_PNG
for the
image/png
MIME type. See the API
documentation for all possible values.
Return values:
Type Description
String
The MIME type.
getName()
Returns the name of the media object, or
null
if the media was
created without a name.
Return values:
Type Description
String
The media object's name.
getReferenceId()
Deprecated. This method will throw an error.
Returns nothing.
getResourceName()
Returns the resource name of the media.
Return values:
Type Description
String
The resource name of the media.
getSourceUrl()
Returns the URL where the original media was downloaded from, or
null
if the media was not obtained via download.
Return values:
Type Description
String
The source URL.
getType()
Returns the media object's type. This is one of
AUDIO
,
DYNAMIC_IMAGE
,
ICON
,
IMAGE
,
STANDARD_ICON
,
VIDEO
, or
MEDIA_BUNDLE
.
Return values:
Type Description
String
The media type.
getUrls()
Returns a
MediaUrls instance for the
media object if it is an image.
Return values:
getYouTubeVideoId()
Returns the YouTube video ID if this media is a YouTube video, or
null
otherwise.
Return values:
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 2025-01-28 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 2025-01-28 UTC."],[[["Represents a Google Ads media object, which can be an image, video, audio, or other media types."],["Provides methods to access properties like file size, MIME type, source URL, and YouTube video ID (if applicable)."],["Includes methods to get the media's ID, name, resource name, and type."],["Offers access to the media's URLs if it is an image via the `getUrls` method."],["`getDimensions` and `getReferenceId` methods are deprecated and will throw an error if used."]]],[]]