Class POBRewardedAd
-
- All Implemented Interfaces:
-
com.pubmatic.sdk.openwrap.core.POBBidEvent
@MainThread() public class POBRewardedAd implements POBBidEvent
Displays full-screen rewarded ads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPOBRewardedAd.POBRewardedAdListenerStatic member class for interaction with the POBRewardedAd instance. All methods are guaranteed to occur on the main thread.
-
Method Summary
Modifier and Type Method Description static POBRewardedAdgetRewardedAd(@NonNull() Context context, @NonNull() String publisherId, int profileId, @NonNull() String adUnitId)Constructor. static POBRewardedAdgetRewardedAd(@NonNull() Context context)Constructor. static POBRewardedAdgetRewardedAd(@NonNull() Context context, @NonNull() String publisherId, int profileId, @NonNull() String adUnitId, @NonNull() POBRewardedAdEvent eventHandler)Initializes and returns newly allocated rewarded ad object. voidsetListener(@Nullable() POBRewardedAd.POBRewardedAdListener rewardedAdListener)Sets instance of class as a listener to get rewarded ad callbacks voidsetSkipAlertDialogInfo(@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. voidloadAd()Initiate the loading of a rewarded ad. voidloadAd(@NonNull() String bidResponse, @NonNull() POBBiddingHost biddingHost)Initiates the loading of a rewarded ad with oRTB bid response. POBImpressiongetImpression()Returns an instance of POBImpression which gets created internally. POBRequestgetAdRequest()Getter for ad request object. voidshow()Presents an rewarded ad in full screen view until the user dismisses it. voidshow(@Nullable() Map<String, Object> customData)Presents an Rewarded ad in full screen view until the user dismisses it. voidaddExtraInfo(@NonNull() String key, @NonNull() Object value)Method to add extra info on POBRewardedAd. List<POBReward>getAvailableRewards()This method returns the list of the available rewards for the loaded Ad. booleanisReady()Method to check whether the ad is loaded and ready to show RewardedAd. voiddestroy()Invoke this method when your activity/fragment is about to destroy. booleanproceedToLoadAd()voidproceedOnError(@NonNull() POBBidEvent.BidEventError error, @NonNull() String errorMessage)POBBidgetBid()Get bid voidsetBidEventListener(@Nullable() POBBidEventListener bidEventListener)Sets the BidEventListener for the ad view Note: Proper reference management practices should be observed when using this listener -
-
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 contextpublisherId- Identifier of the publisherprofileId- Profile ID of an ad tagadUnitId- 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 contextpublisherId- Identifier of the publisherprofileId- Profile ID of an ad tagadUnitId- Ad unit id used to identify unique placement on screeneventHandler- Valid instance of POBRewardedAdEvent
-
setListener
void setListener(@Nullable() POBRewardedAd.POBRewardedAdListener rewardedAdListener)
Sets instance of class as a listener to get rewarded ad callbacks
- Parameters:
rewardedAdListener- Instance of POBRewardedAdListener
-
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 dialogmessage- the message for skip alert dialogresumeTitle- the resume button title for skip alert dialogcloseTitle- the close button title for skip alert dialog
-
loadAd
@RequiresPermission(value = Manifest.permission.INTERNET) void loadAd()
Initiate the loading of a rewarded ad.
-
loadAd
@RequiresPermission(value = Manifest.permission.INTERNET) void loadAd(@NonNull() String bidResponse, @NonNull() POBBiddingHost biddingHost)
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.5biddingHost- enum value representing the bidding provider.
-
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.
-
addExtraInfo
void addExtraInfo(@NonNull() String key, @NonNull() Object value)
Method to add extra info on POBRewardedAd. Use this API to set the values used for rendering the POBRewardedAd ad.
- Parameters:
key- Key corresponding the use of the data passed.value- Value corresponding to the provided key which shall be used at the time of rendering.
-
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.
-
proceedToLoadAd
boolean proceedToLoadAd()
-
proceedOnError
void proceedOnError(@NonNull() POBBidEvent.BidEventError error, @NonNull() String errorMessage)
-
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
-
-
-
-