SearchAdRequest.Builder

public static final class SearchAdRequest.Builder extends Object

Builds a SearchAdRequest.

Public Constructor Summary

Public Method Summary

SearchAdRequest.Builder
addCustomEventExtrasBundle(Class<? extends CustomEvent> adapterClass, Bundle customEventExtras)
Add extra parameters to pass to a specific custom event adapter.
SearchAdRequest.Builder
addNetworkExtras(NetworkExtras networkExtras)
Add extra parameters to pass to a specific ad network adapter.
SearchAdRequest.Builder
addNetworkExtrasBundle(Class<? extends MediationAdapter> adapterClass, Bundle networkExtras)
Add extra parameters to pass to a specific ad network adapter.
SearchAdRequest.Builder
addTestDevice(String deviceId)
Causes a device to receive test ads.
SearchAdRequest
build()
Constructs a SearchAdRequest with the specified attributes.
SearchAdRequest.Builder
setAnchorTextColor(int anchorTextColor)
Sets the color of the ad URL.
SearchAdRequest.Builder
setBackgroundColor(int backgroundColor)
Sets the background color of the ad.
SearchAdRequest.Builder
setBackgroundGradient(int top, int bottom)
Sets a gradient for the ad background.
SearchAdRequest.Builder
setBorderColor(int borderColor)
Sets the border color of the ad container.
SearchAdRequest.Builder
setBorderThickness(int borderThickness)
Sets the thickness of the border in pixels around the ad container.
SearchAdRequest.Builder
setBorderType(int borderType)
Sets the type of border around the ad container.
SearchAdRequest.Builder
setCallButtonColor(int callButtonColor)
Sets the color of the call button when a call extension is shown.
SearchAdRequest.Builder
setCustomChannels(String channelIds)
Sets custom channels for the ad request.
SearchAdRequest.Builder
setDescriptionTextColor(int descriptionTextColor)
Sets the color of the ad description.
SearchAdRequest.Builder
setFontFace(String fontFace)
Sets the font used to render the ad.
SearchAdRequest.Builder
setHeaderTextColor(int headerTextColor)
Sets the text color of the ad header.
SearchAdRequest.Builder
setHeaderTextSize(int headerTextSize)
Sets the font size of the header text in pixels.
SearchAdRequest.Builder
setLocation(Location location)
Sets the user's location for targeting purposes.
SearchAdRequest.Builder
setQuery(String query)
Sets the query for requesting a search ad.
SearchAdRequest.Builder
setRequestAgent(String requestAgent)
Sets the request agent string to identify the ad request's origin.
SearchAdRequest.Builder
tagForChildDirectedTreatment(boolean tagForChildDirectedTreatment)
This method allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children's Online Privacy Protection Act (COPPA) - //business.ftc.gov/privacy-and-security/childrens-privacy.

Inherited Method Summary

Public Constructors

public SearchAdRequest.Builder ()

Public Methods

public SearchAdRequest.Builder addCustomEventExtrasBundle (Class<? extends CustomEvent> adapterClass, Bundle customEventExtras)

Add extra parameters to pass to a specific custom event adapter.

Parameters
adapterClass The Class of the custom event adapter for which you are providing extras.
customEventExtras A Bundle of extra information to pass to a custom event adapter.

public SearchAdRequest.Builder addNetworkExtras (NetworkExtras networkExtras)

Add extra parameters to pass to a specific ad network adapter. The networkExtras parameter should be an instance of com.google.ads.mediation.NetworkExtras, which is provided by ad network adapters.

Note that the NetworkExtras class has been deprecated. This method is included to maintain compatibility with older adapters.

public SearchAdRequest.Builder addNetworkExtrasBundle (Class<? extends MediationAdapter> adapterClass, Bundle networkExtras)

Add extra parameters to pass to a specific ad network adapter.

Parameters
adapterClass The Class of the adapter for the network for which you are providing extras.
networkExtras A Bundle of extra information to pass to a mediation adapter.

public SearchAdRequest.Builder addTestDevice (String deviceId)

Causes a device to receive test ads. The deviceId can be obtained by viewing the logcat output after creating a new ad. For emulators, use DEVICE_ID_EMULATOR.

public SearchAdRequest build ()

Constructs a SearchAdRequest with the specified attributes.

public SearchAdRequest.Builder setAnchorTextColor (int anchorTextColor)

Sets the color of the ad URL. Transparency is not supported. rgb(int, int, int) can be used to specify this color.

public SearchAdRequest.Builder setBackgroundColor (int backgroundColor)

Sets the background color of the ad. Calling this method will override any previous calls to setBackgroundColor(int) or setBackgroundGradient(int, int). Transparency is not supported. rgb(int, int, int) can be used to specify this color.

public SearchAdRequest.Builder setBackgroundGradient (int top, int bottom)

Sets a gradient for the ad background. Calling this method will override any previous calls to setBackgroundColor(int) or setBackgroundGradient(int, int). Transparency is not supported. rgb(int, int, int) can be used to specify these colors.

Parameters
top The color of the gradient at the top of the ad.
bottom The color of the gradient at the bottom of the ad.

public SearchAdRequest.Builder setBorderColor (int borderColor)

Sets the border color of the ad container. Transparency is not supported. rgb(int, int, int) can be used to specify this color. This setting is ignored if setBorderType(int) is set to BORDER_TYPE_NONE.

public SearchAdRequest.Builder setBorderThickness (int borderThickness)

Sets the thickness of the border in pixels around the ad container. This setting is ignored if setBorderType(int) is set to BORDER_TYPE_NONE.

public SearchAdRequest.Builder setBorderType (int borderType)

Sets the type of border around the ad container. This value must be one of BORDER_TYPE_NONE, BORDER_TYPE_DASHED, BORDER_TYPE_DOTTED, BORDER_TYPE_SOLID.

public SearchAdRequest.Builder setCallButtonColor (int callButtonColor)

Sets the color of the call button when a call extension is shown. This value must be one of CALL_BUTTON_COLOR_DARK, CALL_BUTTON_COLOR_LIGHT, CALL_BUTTON_COLOR_MEDIUM.