Class LevelPlayRewardedAd

  • All Implemented Interfaces:

    
    public final class LevelPlayRewardedAd
    
                        

    Class responsible for handling the APIs, callbacks and overall operations of a rewarded ad.

    • Constructor Detail

      • LevelPlayRewardedAd

        LevelPlayRewardedAd(String adUnitId)
        Initializes a rewarded ad.
        Parameters:
        adUnitId - The ad unit identifier.
      • LevelPlayRewardedAd

        LevelPlayRewardedAd(String adUnitId, LevelPlayRewardedAd.Config config)
        Initializes a rewarded ad with configuration.
        Parameters:
        adUnitId - The ad unit identifier.
        config - The ad unit configuration.
    • Method Detail

      • loadAd

         final Unit loadAd()

        Loads a rewarded ad. The listener will send a onAdLoaded() or onAdLoadFailed() callback. The callbacks will be invoked on the main thread.

      • showAd

        @JvmOverloads() final Unit showAd(Activity activity, String placementName)

        Shows the ad. The listener will send a onAdDisplayed() or onAdDisplayFailed() callback. The callbacks will be invoked on the main thread.

        Parameters:
        activity - The activity where the ad will be shown.
        placementName - The placement name for the ad.
      • showAd

        @JvmOverloads() final Unit showAd(Activity activity)

        Shows the ad. The listener will send a onAdDisplayed() or onAdDisplayFailed() callback. The callbacks will be invoked on the main thread.

        Parameters:
        activity - The activity where the ad will be shown.
      • isAdReady

         final Boolean isAdReady()

        Checks if the ad is ready. Showing an ad that is not ready will result in a show failure. When calling to the show api with placement, make sure to verify that placement isn't capped via isPlacementCapped().

        Returns:

        True if the ad is ready, false otherwise.

      • getReward

        @JvmOverloads() final LevelPlayReward getReward(String placement)

        Retrieves the reward associated with the ad.

        Use this method to obtain the reward configured for the ad unit or placement. The placement-specific reward takes precedence over the ad unit reward when a valid placement name is provided.

        Parameters:
        placement - The placement name to retrieve the reward for, or null to use the ad unit's reward.
        Returns:

        A LevelPlayReward object. Returns an empty reward on failures (name: "" and amount: 0).

      • getReward

        @JvmOverloads() final LevelPlayReward getReward()

        Retrieves the reward associated with the ad.

        Use this method to obtain the reward configured for the ad unit or placement. The placement-specific reward takes precedence over the ad unit reward when a valid placement name is provided.

        Returns:

        A LevelPlayReward object. Returns an empty reward on failures (name: "" and amount: 0).

      • isPlacementCapped

         final static Boolean isPlacementCapped(String placementName)

        Checks if the placement is capped.

        Parameters:
        placementName - The placement name to check.
        Returns:

        True if the placement is capped, false otherwise.