Android SDK Version
  • java.lang.Object
    • com.facebook.ads.AdSettings

public class AdSettings
extends java.lang.Object
AdSettings contains global settings for all ad controls.
Since:
4.6
Nested Class Summary
Modifier and TypeClass and Description
static class AdSettings.IntegrationErrorMode 
static class AdSettings.MultiprocessSupportMode 
static class AdSettings.TestAdType
Ad Type to be returned when test mode is on.
Field Summary
Modifier and TypeField and Description
static booleanDEBUG
Deprecated. 
Constructor Summary
Constructor and Description
AdSettings() 
Method Summary
Modifier and TypeMethod and Description
static voidaddTestDevice(java.lang.String deviceIdHash)
Adds a test device.
static voidaddTestDevices(java.util.Collection<java.lang.String> deviceIdHashes)
Adds a collection of test devices.
static voidclearTestDevices()
Clears the collection of test devices.
static java.lang.StringgetMediationService()
Returns the name of the mediation service that is mediating Audience Network
static AdSettings.TestAdTypegetTestAdType() 
static java.lang.StringgetUrlPrefix()
Gets the url prefix.
static booleanisChildDirected()
Gets whether the ad control is targeting a child.
static booleanisTestMode(Context context)
Gets whether ad controls are working in test mode.
static booleanisVideoAutoplay()
Gets whether video autoplay is enabled
static booleanisVideoAutoplayOnMobile()
Gets whether video autoplay is only enabled on Wifi or not
static voidsetDebugBuild(boolean isDebugBuild)
Puts the SDK in debug mode
static voidsetIntegrationErrorMode(AdSettings.IntegrationErrorMode mode)
Specify behaviour of the SDK when client code has an integration error.
static voidsetIsChildDirected(boolean childDirected)
Sets whether the ad control is targeting a child.
static voidsetMediationService(java.lang.String mediationService)
Sets the name of the mediation service that is mediating Audience Network.
static voidsetMultiprocessSupportMode(AdSettings.MultiprocessSupportMode mode)
Specify if the SDK can load and show ads in the separate process.
static voidsetTestAdType(AdSettings.TestAdType testAdType) 
static voidsetTestMode(boolean enabled)
Sets whether ad controls are working in test mode.
static voidsetUrlPrefix(java.lang.String urlPrefix)
Sets the url prefix to use when making requests.
static voidsetVideoAutoplay(boolean enabled)
Sets the setting for video autoplay
static voidsetVideoAutoplayOnMobile(boolean enabled)
Sets the setting for video autoplay on mobile networks
static voidsetVisibleAnimation(boolean enabled) 
static voidturnOnSDKDebugger(Context context)
This is a feature in testing not currently supported
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail

DEBUG

public static final boolean DEBUG
Deprecated. Use setDebugBuild(boolean)} instead.
Constructor Detail

AdSettings

public AdSettings()
Method Detail

setDebugBuild

public static void setDebugBuild(boolean isDebugBuild)
Puts the SDK in debug mode
This is useful for getting debug messages printed to logcat.

turnOnSDKDebugger

public static void turnOnSDKDebugger(Context context)
This is a feature in testing not currently supported
Parameters:
context -
Since:
5.3

addTestDevice

public static void addTestDevice(java.lang.String deviceIdHash)
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.
Parameters:
deviceIdHash - id of the device to use test mode, can be obtained from debug log
Since:
4.6

addTestDevices

public static void addTestDevices(java.util.Collection<java.lang.String> deviceIdHashes)
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.
Parameters:
deviceIdHashes - ids of the device to use test mode, can be obtained from debug log
Since:
4.6

clearTestDevices

public static void clearTestDevices()
Clears the collection of test devices.
Since:
4.6

isTestMode

public static boolean isTestMode(Context context)
Gets whether ad controls are working in test mode.
Parameters:
context - android context
Returns:
whether in test mode
Since:
4.6

setTestMode

public static void setTestMode(boolean enabled)
Sets whether ad controls are working in test mode.
Parameters:
enabled - test mode state

setUrlPrefix

public static void setUrlPrefix(java.lang.String urlPrefix)
Sets the url prefix to use when making requests. This should never be used in production.
Parameters:
urlPrefix - url prefix
Since:
4.6

getUrlPrefix

public static java.lang.String getUrlPrefix()
Gets the url prefix.
Returns:
url prefix
Since:
4.6

isVideoAutoplay

public static boolean isVideoAutoplay()
Gets whether video autoplay is enabled
Returns:
true if video autoplay is enabled
Since:
4.23

isVideoAutoplayOnMobile

public static boolean isVideoAutoplayOnMobile()
Gets whether video autoplay is only enabled on Wifi or not
Returns:
true if video autoplay is enabled only on Wifi
Since:
4.23

setVideoAutoplay

public static void setVideoAutoplay(boolean enabled)
Sets the setting for video autoplay
Parameters:
enabled - whether video autoplay should be enabled or not
Since:
4.23

setVideoAutoplayOnMobile

public static void setVideoAutoplayOnMobile(boolean enabled)
Sets the setting for video autoplay on mobile networks
Parameters:
enabled - whether video autoplay should be enabled only on Wifi
Since:
4.23

setMediationService

public static void setMediationService(java.lang.String mediationService)
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.
Parameters:
mediationService - string representing the name of the mediation service that is mediating Audience Network
Since:
4.23

getMediationService

public static java.lang.String getMediationService()
Returns the name of the mediation service that is mediating Audience Network
Returns:
string representing the name of the mediation service if there is any
Since:
4.23

setIsChildDirected

public static void setIsChildDirected(boolean childDirected)
Sets whether the ad control is targeting a child.
Parameters:
childDirected - whether the ad control is targeting a child
Since:
4.6

isChildDirected

public static boolean isChildDirected()
Gets whether the ad control is targeting a child.
Returns:
whether the ad control is targeting a child
Since:
4.6

setTestAdType

public static void setTestAdType(AdSettings.TestAdType testAdType)
Parameters:
testAdType -
Since:
4.23

getTestAdType

public static AdSettings.TestAdType getTestAdType()
Returns:
Since:
4.23

setVisibleAnimation

public static void setVisibleAnimation(boolean enabled)

setMultiprocessSupportMode

public static void setMultiprocessSupportMode(AdSettings.MultiprocessSupportMode mode)
Specify if the SDK can load and show ads in the separate process. See AdSettings.MultiprocessSupportMode. Default value is AdSettings.MultiprocessSupportMode.MULTIPROCESS_SUPPORT_MODE_AUTO
Since:
5.1

setIntegrationErrorMode

public static void setIntegrationErrorMode(AdSettings.IntegrationErrorMode mode)
Specify behaviour of the SDK when client code has an integration error. See AdSettings.IntegrationErrorMode
Since:
5.1