SearchAdRequest

public final class SearchAdRequest extends Object

A SearchAdRequest contains targeting information used to fetch an ad from Search Ads for Apps. Ad requests are created using SearchAdRequest.Builder.

Nested Class Summary

class SearchAdRequest.Builder Builds a SearchAdRequest

Constant Summary

int BORDER_TYPE_DASHED Dashed border.
int BORDER_TYPE_DOTTED Dotted border.
int BORDER_TYPE_NONE No border.
int BORDER_TYPE_SOLID Solid border.
int CALL_BUTTON_COLOR_DARK Dark-colored call button.
int CALL_BUTTON_COLOR_LIGHT Light-colored call button.
int CALL_BUTTON_COLOR_MEDIUM Medium-colored call button.
String DEVICE_ID_EMULATOR The deviceId for emulators to be used with addTestDevice(String).
int ERROR_CODE_INTERNAL_ERROR Something happened internally; for instance, an invalid response was received from the ad server.
int ERROR_CODE_INVALID_REQUEST The ad request was invalid; for instance, the ad unit ID was incorrect.
int ERROR_CODE_NETWORK_ERROR The ad request was unsuccessful due to network connectivity.
int ERROR_CODE_NO_FILL The ad request was successful, but no ad was returned due to lack of ad inventory.

Public Method Summary

int
getAnchorTextColor()
Returns the color of the ad URL.
int
getBackgroundColor()
Returns the background color of the ad.
int
getBackgroundGradientBottom()
Returns the color of the background gradient at the bottom of the ad.
int
getBackgroundGradientTop()
Returns the color of the background gradient at the top of the ad.
int
getBorderColor()
Returns the border color of the ad container.
int
getBorderThickness()
Returns the thickness of the border in pixels around the ad container.
int
getBorderType()
Returns the type of border around the ad container.
int
getCallButtonColor()
Returns the color of the call button when a call extension is shown.
String
getCustomChannels()
Returns the custom channels for the ad request.
<T extends CustomEvent> Bundle
getCustomEventExtrasBundle(Class<T> adapterClass)
Returns extra parameters to pass to a specific custom event adapter.
int
getDescriptionTextColor()
Returns the color of the ad description.
String
getFontFace()
Returns the font used to render the ad.
int
getHeaderTextColor()
Returns the font size of the header text in pixels.
int
getHeaderTextSize()
Returns the font size of the header text in pixels.
Location
getLocation()
Returns the user's location targeting information.
<T extends NetworkExtras> T
getNetworkExtras(Class<T> networkExtrasClass)
Returns extra parameters to pass to a specific ad network adapter.
<T extends MediationAdapter> Bundle
getNetworkExtrasBundle(Class<T> adapterClass)
Returns extra parameters to pass to a specific ad network adapter.
String
getQuery()
Returns the query of the search ad request.
boolean
isTestDevice(Context context)
Returns true if this device will receive test ads.

Inherited Method Summary

Constants

public static final int BORDER_TYPE_DASHED

Dashed border.

Constant Value: 1

public static final int BORDER_TYPE_DOTTED

Dotted border.

Constant Value: 2

public static final int BORDER_TYPE_NONE

No border.

Constant Value: 0

public static final int BORDER_TYPE_SOLID

Solid border.

Constant Value: 3

public static final int CALL_BUTTON_COLOR_DARK

Dark-colored call button.

Constant Value: 2

public static final int CALL_BUTTON_COLOR_LIGHT

Light-colored call button.

Constant Value: 0

public static final int CALL_BUTTON_COLOR_MEDIUM

Medium-colored call button.

Constant Value: 1

public static final String DEVICE_ID_EMULATOR

The deviceId for emulators to be used with addTestDevice(String).

Constant Value: "B3EEABB8EE11C2BE770B684D95219ECB"

public static final int ERROR_CODE_INTERNAL_ERROR

Something happened internally; for instance, an invalid response was received from the ad server.

Constant Value: 0

public static final int ERROR_CODE_INVALID_REQUEST

The ad request was invalid; for instance, the ad unit ID was incorrect.

Constant Value: 1

public static final int ERROR_CODE_NETWORK_ERROR

The ad request was unsuccessful due to network connectivity.

Constant Value: 2

public static final int ERROR_CODE_NO_FILL

The ad request was successful, but no ad was returned due to lack of ad inventory.

Constant Value: 3

Public Methods

public int getAnchorTextColor ()

Returns the color of the ad URL.

public int getBackgroundColor ()

Returns the background color of the ad.

public int getBackgroundGradientBottom ()

Returns the color of the background gradient at the bottom of the ad.

public int getBackgroundGradientTop ()

Returns the color of the background gradient at the top of the ad.

public int getBorderColor ()

Returns the border color of the ad container.

public int getBorderThickness ()

Returns the thickness of the border in pixels around the ad container.

public int getBorderType ()

Returns the type of border around the ad container.

public int getCallButtonColor ()

Returns the color of the call button when a call extension is shown.

public String getCustomChannels ()

Returns the custom channels for the ad request. Custom channels allow publishers to track the performance of specific groups of ads. These custom channels need to created on the AdSense website. Reports can then be created based on the channels.

public Bundle getCustomEventExtrasBundle (Class<T> adapterClass)

Returns extra parameters to pass to a specific custom event adapter. Returns null if no custom event extras of the provided type were set.

public int getDescriptionTextColor ()

Returns the color of the ad description.

public String getFontFace ()

Returns the font used to render the ad. The same font is used in the header, the description and the anchor.

public int getHeaderTextColor ()

Returns the font size of the header text in pixels.

public int getHeaderTextSize ()

Returns the font size of the header text in pixels. The font sizes for the description and the anchor are determined from the header size.

public Location getLocation ()

Returns the user's location targeting information. Returns null if the location was not set.

public T getNetworkExtras (Class<T> networkExtrasClass)

Returns extra parameters to pass to a specific ad network adapter. Ad network adapters provide a NetworkExtras class. Returns null if no network extras of the provided type were set.

public Bundle getNetworkExtrasBundle (Class<T> adapterClass)

Returns extra parameters to pass to a specific ad network adapter. Returns null if no network extras of the provided type were set.

public String getQuery ()

Returns the query of the search ad request.

public boolean isTestDevice (Context context)

Returns true if this device will receive test ads.

Send feedback about...

Need help? Visit our support page.