Interface DynamicAd

All Known Implementing Classes:
DynamicAppOpenAd, DynamicBannerAd, DynamicBaseAd, DynamicInterstitialAd, DynamicNativeAd, DynamicRewardedAd, DynamicRewardedInterstitialAd

public interface DynamicAd
An interface to implement a dynamic ad.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static @interface 
    An interface to hold default values.
    static @interface 
    An interface to hold key constants.
    static @interface 
    An interface to hold value constants.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Class name for the dynamic widget.
    static final String
    Shared preferences key constant if GDPR applies.
    static final String
    Shared preferences key constant for purpose consents.
    static final String
    Shared preferences key constant for purpose legitimate interests.
    static final String
    Shared preferences key constant for vendor consents.
    static final String
    Shared preferences key constant for vendor legitimate interests.
    static final int
    Constant for the no layout resource.
    static final String
    File name for the dynamic ads preferences.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the optional layout resource for this ad.
    Returns the listener used by this ad.
    com.google.android.gms.ads.AdRequest
    This method will be called to build the ad request for this ad.
    com.google.android.gms.ads.RequestConfiguration
    This method will be called to get the ad request configurations.
    Returns the unit id for this ad.
    com.google.android.ump.ConsentForm
    Returns the consent form if available.
    com.google.android.ump.ConsentInformation
    Returns the consent information if available.
    boolean
    Checks if any constraints should be matched before loading the ad.
    boolean
    Checks whether the ad has been loaded.
    boolean
    Returns whether this ad is visible to the user.
    void
    Try to create the new ad.
    void
    Try to destroy the ad instances and do cleanup.
    void
    Try to pause the running ad.
    void
    Try to resume the paused ad.
    void
    onCustomiseAd(boolean loaded)
    This method will be called to do the ad customisations.
    void
    This method will be called to do the initialization.
    void
    onPostAdLoaded(boolean loaded)
    This method will be called after the ad has been loaded.
    void
    Try to populate the new ad.
  • Field Details

    • LAYOUT_RES_NONE

      static final int LAYOUT_RES_NONE
      Constant for the no layout resource.
      See Also:
    • CLASS_DYNAMIC_WIDGET

      static final String CLASS_DYNAMIC_WIDGET
      Class name for the dynamic widget.
      See Also:
    • PREFS

      static final String PREFS
      File name for the dynamic ads preferences.
      See Also:
    • IABTCF_gdprApplies

      static final String IABTCF_gdprApplies
      Shared preferences key constant if GDPR applies.
      See Also:
    • IABTCF_PurposeConsents

      static final String IABTCF_PurposeConsents
      Shared preferences key constant for purpose consents.
      See Also:
    • IABTCF_PurposeLegitimateInterests

      static final String IABTCF_PurposeLegitimateInterests
      Shared preferences key constant for purpose legitimate interests.
      See Also:
    • IABTCF_VendorConsents

      static final String IABTCF_VendorConsents
      Shared preferences key constant for vendor consents.
      See Also:
    • IABTCF_VendorLegitimateInterests

      static final String IABTCF_VendorLegitimateInterests
      Shared preferences key constant for vendor legitimate interests.
      See Also:
  • Method Details

    • getAdUnitId

      @NonNull String getAdUnitId()
      Returns the unit id for this ad.
      Returns:
      The unit id for this ad.
    • getAdLayoutRes

      @LayoutRes int getAdLayoutRes()
      Returns the optional layout resource for this ad.
      Returns:
      The optional layout resource for this ad.
    • getAdListener

      @NonNull BaseAdListener getAdListener()
      Returns the listener used by this ad.
      Returns:
      The listener used by this ad.
    • onInitialize

      void onInitialize()
      This method will be called to do the initialization.
    • getConsentInformation

      @Nullable com.google.android.ump.ConsentInformation getConsentInformation()
      Returns the consent information if available.
      Returns:
      The consent information if available.
    • getConsentForm

      @Nullable com.google.android.ump.ConsentForm getConsentForm()
      Returns the consent form if available.
      Returns:
      The consent form if available.
    • getAdRequest

      @NonNull com.google.android.gms.ads.AdRequest getAdRequest()
      This method will be called to build the ad request for this ad.
      Returns:
      The ad request for this ad.
    • getAdRequestConfigurations

      @NonNull com.google.android.gms.ads.RequestConfiguration getAdRequestConfigurations()
      This method will be called to get the ad request configurations.
      Returns:
      The ad request configurations.
    • onAdCreate

      void onAdCreate()
      Try to create the new ad.
    • onCustomiseAd

      void onCustomiseAd(boolean loaded)
      This method will be called to do the ad customisations.
      Parameters:
      loaded - true if the ad was already loaded and using the previous instance.
    • onPostAdLoaded

      void onPostAdLoaded(boolean loaded)
      This method will be called after the ad has been loaded.
      Parameters:
      loaded - true if the ad was already loaded and using the previous instance.
    • isAdAllowed

      boolean isAdAllowed()
      Checks if any constraints should be matched before loading the ad.
      Returns:
      true if the ad is allowed to be loaded.
    • isAdLoaded

      boolean isAdLoaded()
      Checks whether the ad has been loaded.
      Returns:
      true if the ad has been loaded.
    • populateAd

      void populateAd()
      Try to populate the new ad.
    • isAdVisible

      boolean isAdVisible()
      Returns whether this ad is visible to the user.
      Returns:
      true if this ad is visible to the user.
    • onAdResume

      void onAdResume()
      Try to resume the paused ad.
    • onAdPause

      void onAdPause()
      Try to pause the running ad.
    • onAdDestroy

      void onAdDestroy()
      Try to destroy the ad instances and do cleanup.