public final class FeedAd
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TAG |
static java.lang.String |
VERSION
The FeedAd SDK version
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addListener(FeedAdListener listener)
Add a new listener that gets notified about Feedclip-SDK Events.
|
static boolean |
canRequestAd(java.lang.String placementId)
This method is only useful for standalone ads or interstitials.
|
static CustomParameters |
customParameters()
Returns an object to set custom parameters for all ad requests or for requests of specific placements.
|
static void |
init(android.content.Context context,
java.lang.String clientToken)
Deprecated.
Please use the
init(Context, String, boolean, boolean) method. |
static void |
init(android.content.Context context,
java.lang.String clientToken,
boolean enableLogging)
Deprecated.
Please use the
init(Context, String, boolean, boolean) method. |
static void |
init(android.content.Context context,
java.lang.String clientToken,
boolean enableLogging,
boolean waitForConsent)
Initializes the SDK.
|
static boolean |
isActive(java.lang.String placementId)
Checks if the SDK is currently playing an ad of a given placement's group.
|
static boolean |
isRequesting(java.lang.String placementId)
Checks if the SDK is currently loading an ad of a placement group of a given placement id.
|
static boolean |
isSupported()
Checks if the FeedAd ads are supported on the current device
|
static void |
removeListener(FeedAdListener listener)
Remove a previously registered
FeedAdListener from the SDK |
static void |
requestAd(java.lang.String placementId)
Manually requests an advertisement for a given placement ID.
|
static void |
requestAd(java.lang.String placementId,
RequestOptions requestOptions)
Manually requests an advertisement for a given placement ID.
|
static InterstitialAd |
requestInterstitialAd(android.content.Context context,
java.lang.String placementId,
InterstitialAdListener adListener)
Request an interstitial ad.
|
static InterstitialAd |
requestInterstitialAd(android.content.Context context,
java.lang.String placementId,
InterstitialAdListener adListener,
RequestOptions requestOptions)
Request an interstitial ad.
|
static StandaloneAd |
requestStandaloneAd(android.content.Context context,
java.lang.String placementId,
StandaloneAdListener adListener)
Request an ad that is displayed inside a single view.
|
static StandaloneAd |
requestStandaloneAd(android.content.Context context,
java.lang.String placementId,
StandaloneAdListener adListener,
RequestOptions requestOptions)
Request an ad that is displayed inside a single view.
|
static void |
sendCustomEvent(CustomEvent event)
Sends a custom event to the FeedAd Server.
|
static void |
setConfig(FeedAdConfig config)
Configure the SDK with custom options like user id, age and gender.
|
static void |
stop()
Stops all current ad playback.
|
static boolean |
validatePlacementId(java.lang.String placementId)
Validate if the the placement ID is of a correct format.
|
public static final java.lang.String VERSION
public static final java.lang.String TAG
public static boolean validatePlacementId(@Nullable
java.lang.String placementId)
placementId - the placement id to validatepublic static boolean isSupported()
@Deprecated
public static void init(android.content.Context context,
java.lang.String clientToken)
init(Context, String, boolean, boolean) method.context - any context instanceclientToken - the client token that can be obtained via the SDK admin website.@Deprecated
public static void init(android.content.Context context,
java.lang.String clientToken,
boolean enableLogging)
init(Context, String, boolean, boolean) method.context - any context instanceclientToken - the client token that can be obtained via the SDK admin website.enableLogging - if the SDK should send log messages to logcat. All SDK log messages are prefixed by 'FeedAd:'public static void init(android.content.Context context,
java.lang.String clientToken,
boolean enableLogging,
boolean waitForConsent)
context - any context instanceclientToken - the client token that can be obtained via the SDK admin website.enableLogging - if the SDK should send log messages to logcat. All SDK log messages are prefixed by 'FeedAd:'waitForConsent - if the SDK should wait for the initialization of a TCF 2.0 CMPpublic static void requestAd(@NonNull
java.lang.String placementId)
placementId - the placement ID of the adpublic static void requestAd(@NonNull
java.lang.String placementId,
@Nullable
RequestOptions requestOptions)
placementId - the placement ID of the adrequestOptions - Additional ad request options. Use AdRequestOptions.Builder to create them.public static boolean isActive(java.lang.String placementId)
placementId - the placement id to check forpublic static boolean isRequesting(java.lang.String placementId)
placementId - the placement id to check forpublic static void stop()
@NonNull public static StandaloneAd requestStandaloneAd(@NonNull android.content.Context context, @NonNull java.lang.String placementId, @NonNull StandaloneAdListener adListener)
context - The context to request the ad for.placementId - the placement to displayadListener - a listener with several callbacks for ad events.
Use the StandaloneAdListener.onAdLoaded(StandaloneAdViewFactory) method to wait for the ad to be ready and include the ad view into your layout.@NonNull public static StandaloneAd requestStandaloneAd(@NonNull android.content.Context context, @NonNull java.lang.String placementId, @NonNull StandaloneAdListener adListener, @Nullable RequestOptions requestOptions)
context - The context to request the ad for.placementId - the placement to displayadListener - a listener with several callbacks for ad events.
Use the StandaloneAdListener.onAdLoaded(StandaloneAdViewFactory) method to wait for the ad to be ready and include the ad view into your layout.requestOptions - Additional ad request options. Use AdRequestOptions.Builder to create them.@NonNull public static InterstitialAd requestInterstitialAd(@NonNull android.content.Context context, @NonNull java.lang.String placementId, @NonNull InterstitialAdListener adListener)
context - Any context instance. The app context will be used internally. No strong activity reference will be held by the Interstitial Ad.placementId - The placement to displayadListener - a listener with interstitial ad callbacks.InterstitialAdListener.onAdLoaded(InterstitialAdPresenter) method.
You can then display the interstitial using InterstitialAdPresenter.show(Activity, boolean).@NonNull public static InterstitialAd requestInterstitialAd(@NonNull android.content.Context context, @NonNull java.lang.String placementId, @NonNull InterstitialAdListener adListener, @Nullable RequestOptions requestOptions)
context - Any context instance. The app context will be used internally. No strong activity reference will be held by the Interstitial Ad.placementId - The placement to displayadListener - a listener with interstitial ad callbacks.InterstitialAdListener.onAdLoaded(InterstitialAdPresenter) method.
You can then display the interstitial using InterstitialAdPresenter.show(Activity, boolean).requestOptions - Additional ad request options. Use AdRequestOptions.Builder to create them.public static boolean canRequestAd(@NonNull
java.lang.String placementId)
This method is only useful for standalone ads or interstitials.
Checks if an ad can be requested for the given placement. It is not required to call this method prior to requesting standalones or interstitials but checking it can save some time and prevent unnecessary network requests.
The value returned from this method is volatile and should only be used to check if an immediately following ad request would be sensible.
placementId - the placement to checkpublic static void sendCustomEvent(@NonNull
CustomEvent event)
event - the event to sendjava.lang.NullPointerException - if the event is nullpublic static void setConfig(@Nullable
FeedAdConfig config)
config - the sdk config or null to revert remove all custom options. Use FeedAdConfig.newBuilder() to create the config.@NonNull public static CustomParameters customParameters()
CustomParameters - for more info on how to set paramspublic static void addListener(FeedAdListener listener)
FeedAdListener implementation keeps a reference to
an activity-level Context. To prevent this, always
call removeListener(FeedAdListener) at the appropriate lifecycle state.listener - the listener to add to the SDKpublic static void removeListener(FeedAdListener listener)
FeedAdListener from the SDKlistener - the listener to remove.