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

public final class AudienceNetworkAds
extends java.lang.Object
The class contains methods that are used across whole Audience Network SDK during lifetime of the application. initialize(Context) should be called as early as possible from android.app.Application#onCreate or from android.app.Activity#onCreate that contains Ads if you don't use custom android.app.Application class.
Since:
5.1
Nested Class Summary
Modifier and TypeClass and Description
static interface AudienceNetworkAds.AdFormat
Constants that represent Audience Network SDK Ad Formats.
static interface AudienceNetworkAds.InitListener
The interface that allows receive callback when initialization of the SDK is done.
static interface AudienceNetworkAds.InitResult
Result of initialization.
static interface AudienceNetworkAds.InitSettingsBuilder
A builder class that allows to pass additional setting during initialization.
Field Summary
Modifier and TypeField and Description
static java.lang.StringTAG 
Method Summary
Modifier and TypeMethod and Description
static AudienceNetworkAds.InitSettingsBuilderbuildInitSettings(Context context)
Allows initialize the Audience Network SDK with additional settings.
static intgetAdFormatForPlacement(Context context, java.lang.String placementId)
Returns AudienceNetworkAds.AdFormat for the placement.
static java.lang.StringgetAdsProcessName(Context context)
Returns name of Ads Process in format ":PROCESS_NAME".
static voidinitialize(Context context)
Initialize the Audience Network SDK.
static booleanisInAdsProcess(Context context)
Verifies if current process is process created by Audience Network SDK.
static booleanisInitialized(Context context)
Returns true if Audience Network SDK has been already initialized.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail

TAG

public static final java.lang.String TAG
Method Detail

initialize

public static void initialize(Context context)
Initialize the Audience Network SDK.
Parameters:
context - The Context of the application.
Since:
5.1

isInAdsProcess

public static boolean isInAdsProcess(Context context)
Verifies if current process is process created by Audience Network SDK. You should call this method from android.app.Application#onCreate method. Typically you would like to skip any other initialization work in your android.app.Application class if current process is Audience Network SDK process.
Returns:
boolean Whether process is created by Audience Network SDK.
Since:
5.1

getAdsProcessName

public static java.lang.String getAdsProcessName(Context context)
Returns name of Ads Process in format ":PROCESS_NAME".
Returns:
ads process name.
Since:
5.3

isInitialized

public static boolean isInitialized(Context context)
Returns true if Audience Network SDK has been already initialized. If you initialize SDK in Activity.onCreate() method, you might want to use it to avoid calling method twice.
Returns:
if SDK has been initialized.
Since:
5.3

buildInitSettings

public static AudienceNetworkAds.InitSettingsBuilder buildInitSettings(Context context)
Allows initialize the Audience Network SDK with additional settings.
Parameters:
context - The Context of the application.
Since:
5.2

getAdFormatForPlacement

public static int getAdFormatForPlacement(Context context,
                                          java.lang.String placementId)
Returns AudienceNetworkAds.AdFormat for the placement.
Parameters:
context - a Context.
placementId - the placement id.
Returns:
integer that corresponds to one of constants in AudienceNetworkAds.AdFormat.
Since:
5.3