Class DynamicBaseAd

java.lang.Object
com.pranavpandey.android.dynamic.ads.DynamicBaseAd
All Implemented Interfaces:
DynamicAd
Direct Known Subclasses:
DynamicAppOpenAd, DynamicBannerAd, DynamicInterstitialAd, DynamicNativeAd, DynamicRewardedAd, DynamicRewardedInterstitialAd

public abstract class DynamicBaseAd extends Object implements DynamicAd
An abstract class to implement a DynamicAd.
  • Constructor Details

    • DynamicBaseAd

      public DynamicBaseAd()
  • Method Details

    • getAdRequest

      @NonNull public com.google.android.gms.ads.AdRequest getAdRequest()
      Description copied from interface: DynamicAd
      This method will be called to build the ad request for this ad.
      Specified by:
      getAdRequest in interface DynamicAd
      Returns:
      The ad request for this ad.
    • getAdRequestConfigurations

      @NonNull public com.google.android.gms.ads.RequestConfiguration getAdRequestConfigurations()
      Description copied from interface: DynamicAd
      This method will be called to get the ad request configurations.
      Specified by:
      getAdRequestConfigurations in interface DynamicAd
      Returns:
      The ad request configurations.
    • isAdAllowed

      public boolean isAdAllowed()
      Description copied from interface: DynamicAd
      Checks if any constraints should be matched before loading the ad.
      Specified by:
      isAdAllowed in interface DynamicAd
      Returns:
      true if the ad is allowed to be loaded.
    • onCustomiseAd

      public void onCustomiseAd(boolean loaded)
      Description copied from interface: DynamicAd
      This method will be called to do the ad customisations.
      Specified by:
      onCustomiseAd in interface DynamicAd
      Parameters:
      loaded - true if the ad was already loaded and using the previous instance.
    • onPostAdLoaded

      public void onPostAdLoaded(boolean loaded)
      Description copied from interface: DynamicAd
      This method will be called after the ad has been loaded.
      Specified by:
      onPostAdLoaded in interface DynamicAd
      Parameters:
      loaded - true if the ad was already loaded and using the previous instance.
    • populateAd

      public void populateAd()
      Description copied from interface: DynamicAd
      Try to populate the new ad.
      Specified by:
      populateAd in interface DynamicAd
    • isAdVisible

      public boolean isAdVisible()
      Description copied from interface: DynamicAd
      Returns whether this ad is visible to the user.
      Specified by:
      isAdVisible in interface DynamicAd
      Returns:
      true if this ad is visible to the user.
    • setAdVisible

      public void setAdVisible(boolean adVisible)
      Sets whether this ad is visible to the user.
      Parameters:
      adVisible - true if this add is visible to the user.
    • onAdDestroy

      public void onAdDestroy()
      Description copied from interface: DynamicAd
      Try to destroy the ad instances and do cleanup.
      Specified by:
      onAdDestroy in interface DynamicAd