Class POBRewardedAd

  • All Implemented Interfaces:
    com.pubmatic.sdk.openwrap.core.POBBidEvent

    @MainThread() 
    public class POBRewardedAd
     implements POBBidEvent
                        

    Displays full-screen rewarded ads.

    • Constructor Detail

    • Method Detail

      • getRewardedAd

        @Nullable() static POBRewardedAd getRewardedAd(@NonNull() Context context, @NonNull() String publisherId, int profileId, @NonNull() String adUnitId)

        Constructor. Initializes and returns newly allocated rewarded ad object for supporting 'No Ad Server Configuration'. Returns null when input parameters are invalid. Note: In case of 'No Ad Server Configuration' it is application side responsibility to call destroy for every ad instance created.

        Parameters:
        context - Activity/Application context
        publisherId - Identifier of the publisher
        profileId - Profile ID of an ad tag
        adUnitId - Ad unit id used to identify unique placement on screen
      • getRewardedAd

        @NonNull() static POBRewardedAd getRewardedAd(@NonNull() Context context)

        Constructor. Initializes and returns newly allocated rewarded ad object for supporting MAX bidding Note: it is application side responsibility to call destroy for every ad instance created.

        Parameters:
        context - Activity/Application context
      • getRewardedAd

        @Nullable() static POBRewardedAd getRewardedAd(@NonNull() Context context, @NonNull() String publisherId, int profileId, @NonNull() String adUnitId, @NonNull() POBRewardedAdEvent eventHandler)

        Initializes and returns newly allocated rewarded ad object. Returns null when input parameters are invalid.

        Parameters:
        context - Activity/Application context
        publisherId - Identifier of the publisher
        profileId - Profile ID of an ad tag
        adUnitId - Ad unit id used to identify unique placement on screen
        eventHandler - Valid instance of POBRewardedAdEvent
      • setSkipAlertDialogInfo

         void setSkipAlertDialogInfo(@NonNull() String title, @NonNull() String message, @NonNull() String resumeTitle, @NonNull() String closeTitle)

        To set info to skip alert dialog, use/set this before calling loadAd method. Note: This method validate parameter values, if one of the parameter is null or empty then the skip alert uses default values.

        Parameters:
        title - the title for skip alert dialog
        message - the message for skip alert dialog
        resumeTitle - the resume button title for skip alert dialog
        closeTitle - the close button title for skip alert dialog
      • loadAd

         void loadAd()

        Initiate the loading of a rewarded ad.

      • loadAd

         void loadAd(@NonNull() String bidResponse)

        Initiates the loading of a rewarded ad with oRTB bid response. This API expects the response with oRTB v2.5 specification.

        Parameters:
        bidResponse - oRTB response of format - oRTB-2.5
      • getImpression

        @Nullable() POBImpression getImpression()

        Returns an instance of POBImpression which gets created internally. POBImpression provides the APIs to set PubMatic zone id and other custom parameters.

        Returns:

        Returns an instance of POBImpression.

      • getAdRequest

        @Nullable() POBRequest getAdRequest()

        Getter for ad request object. It returns null, only when the arguments provided in the constructor are not valid like publisherId or adUnitId.

        Returns:

        POBRequest object

      • show

         void show()

        Presents an rewarded ad in full screen view until the user dismisses it. Note: Calling this method has no effect until the ad is received i.e. onAdReceived() gets called.

      • show

         void show(@Nullable() Map<String, Object> customData)

        Presents an Rewarded ad in full screen view until the user dismisses it. Publisher should invoke this method when the primary ad server SDK expects to get notified about the reward selection. This method will convey the selected reward to the event handler.

        Note: Calling this method has no effect until the ad is received i.e. onAdReceived() gets called.

        Parameters:
        customData - Publisher should pass the custom data to be used for Reward selection like: Select the rewards among the multiple configured rewards and pass it in this method.
      • getAvailableRewards

        @Nullable() List<POBReward> getAvailableRewards()

        This method returns the list of the available rewards for the loaded Ad. It should be called after an Ad has been received and before destroy method called to get valid list of rewards.

        Returns:

        the list of available rewards for the loaded Ad. It may return null, if the reward is not configured to respective Ad server (OW / primary ad server) or when this method gets called before an Ad has been received or after ad has been destroyed.

      • isReady

         boolean isReady()

        Method to check whether the ad is loaded and ready to show RewardedAd.

        Returns:

        Returns true if the Rewarded Ad is ready to be displayed else returns false.

      • destroy

         void destroy()

        Invoke this method when your activity/fragment is about to destroy. It cleans the resources.

      • setBidEventListener

         void setBidEventListener(@Nullable() POBBidEventListener bidEventListener)

        Sets the BidEventListener for the ad view Note: Proper reference management practices should be observed when using this listener

        Parameters:
        bidEventListener - reference of POBBidEventListener