AdSettings
有此級別的更新版本。前往查看 最新版本。

AdSettings contains global settings for all ad controls.

延伸:Object
套件:ads
建構函式
AdSettings()
public AdSettings()
類別方式
addTestDevice(String)

Adds a test device.

Copy the current device Id from debug log and add it as a test device to get test ads. Apps running on emulator will automatically get test ads. Test devices should be added before Ad.loadAd() is called.

public static void addTestDevice(String deviceIdHash)
參數說明
deviceIdHashId of the device to use test mode, can be obtained from debug log
addTestDevices(Collection)

Adds a collection of test devices.

Copy the current device Id from debug log and add it as a test device to get test ads. Apps running on emulator will automatically get test ads. Test devices should be added before Ad.loadAd() is called.

public static void addTestDevices(Collection deviceIdHashes)
參數說明
deviceIdHashesIds of the device to use test mode, can be obtained from debug log
clearTestDevices()

Clears the collection of test devices.

public static void clearTestDevices()
isTestMode(Context)

Gets whether ad controls are working in test mode.

public static boolean isTestMode(Context context)
參數說明
contextAndroid context
Returns
Whether in test mode
setUrlPrefix(String)

Sets the url prefix to use when making requests. This should never be used in production.

public static void setUrlPrefix(String urlPrefix)
參數說明
urlPrefixUrl prefix
getUrlPrefix()

Gets the url prefix.

public static String getUrlPrefix()
Returns
Url prefix
isVideoAutoplay()

Gets whether video autoplay is enabled

public static boolean isVideoAutoplay()
Returns
True if video autoplay is enabled
isVideoAutoplayOnMobile()

Gets whether video autoplay is only enabled on Wifi or not

public static boolean isVideoAutoplayOnMobile()
Returns
True if video autoplay is enabled only on Wifi
setVideoAutoplay(boolean)

Sets the setting for video autoplay

public static void setVideoAutoplay(boolean enabled)
參數說明
enabledWhether video autoplay should be enabled or not
setVideoAutoplayOnMobile(boolean)

Sets the setting for video autoplay on mobile networks

public static void setVideoAutoplayOnMobile(boolean enabled)
參數說明
enabledWhether video autoplay should be enabled only on Wifi
setMediationService(String)

Sets the name of the mediation service that is mediating Audience Network.

If an ad provider service is mediating Audience Network in their sdk, it is required to set the name of the mediation service.

public static void setMediationService(String mediationService)
參數說明
mediationServiceString representing the name of the mediation service that is mediating Audience Network
getMediationService()

Returns the name of the mediation service that is mediating Audience Network

public static String getMediationService()
Returns
String representing the name of the mediation service if there is any
setIsChildDirected(boolean)

Sets whether the ad control is targeting a child.

public static void setIsChildDirected(boolean childDirected)
參數說明
childDirectedWhether the ad control is targeting a child
isChildDirected()

Gets whether the ad control is targeting a child.

public static boolean isChildDirected()
Returns
Whether the ad control is targeting a child
常數
DEBUG
public static final boolean DEBUG