@MainThread public class POBRewardedAd extends java.lang.Object implements POBBidEvent
Modifier and Type | Class and Description |
---|---|
static class |
POBRewardedAd.POBRewardedAdListener
Static member class for interaction with the POBRewardedAd instance.
|
POBBidEvent.BidEventError
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Invoke this method when your activity/fragment is about to destroy.
|
POBRequest |
getAdRequest()
Getter for ad request object.
|
java.util.List<POBReward> |
getAvailableRewards()
This method returns the list of the available rewards for the loaded Ad.
|
POBBid |
getBid()
Get bid
|
POBImpression |
getImpression()
Returns an instance of POBImpression which gets created internally.
|
static POBRewardedAd |
getRewardedAd(Context context)
Constructor.
|
static POBRewardedAd |
getRewardedAd(Context context,
java.lang.String publisherId,
int profileId,
java.lang.String adUnitId)
Constructor.
|
static POBRewardedAd |
getRewardedAd(Context context,
java.lang.String publisherId,
int profileId,
java.lang.String adUnitId,
com.pubmatic.sdk.rewardedad.POBRewardedAdEvent eventHandler)
Initializes and returns newly allocated rewarded ad object.
|
boolean |
isReady()
Method to check whether the ad is loaded and ready to show RewardedAd.
|
void |
loadAd()
Initiate the loading of a rewarded ad.
|
void |
loadAd(java.lang.String bidResponse)
Initiates the loading of a rewarded ad with oRTB bid response.
|
void |
proceedOnError(POBBidEvent.BidEventError error,
java.lang.String errorMessage)
Introduced in OpenWrapSDK v3.6.0
|
boolean |
proceedToLoadAd()
Proceeds with bid flow, This method should be called only when
POBBidEventListener is set
Note: Should be called from Main/UI thread. |
void |
setBidEventListener(POBBidEventListener bidEventListener)
Sets the BidEventListener for the ad view
Note: Proper reference management practices should be observed when using this listener
|
void |
setListener(POBRewardedAd.POBRewardedAdListener rewardedAdListener)
Sets instance of class as a listener to get rewarded ad callbacks
|
void |
setSkipAlertDialogInfo(java.lang.String title,
java.lang.String message,
java.lang.String resumeTitle,
java.lang.String closeTitle)
To set info to skip alert dialog, use/set this before calling
loadAd() method. |
void |
show()
Presents an rewarded ad in full screen view until the user dismisses it.
|
void |
show(java.util.Map<java.lang.String,java.lang.Object> customData)
Presents an Rewarded ad in full screen view until the user dismisses it.
|
@Nullable public static POBRewardedAd getRewardedAd(@NonNull Context context, @NonNull java.lang.String publisherId, int profileId, @NonNull java.lang.String adUnitId)
destroy()
for every ad instance created.context
- Activity/Application contextpublisherId
- Identifier of the publisherprofileId
- Profile ID of an ad tagadUnitId
- Ad unit id used to identify unique placement on screen@NonNull public static POBRewardedAd getRewardedAd(@NonNull Context context)
destroy()
for every ad instance created.context
- Activity/Application context@Nullable public static POBRewardedAd getRewardedAd(@NonNull Context context, @NonNull java.lang.String publisherId, int profileId, @NonNull java.lang.String adUnitId, @NonNull com.pubmatic.sdk.rewardedad.POBRewardedAdEvent eventHandler)
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 POBRewardedAdEventpublic void setListener(@Nullable POBRewardedAd.POBRewardedAdListener rewardedAdListener)
rewardedAdListener
- Instance of POBRewardedAdListenerpublic void setSkipAlertDialogInfo(@NonNull java.lang.String title, @NonNull java.lang.String message, @NonNull java.lang.String resumeTitle, @NonNull java.lang.String closeTitle)
loadAd()
method.
Note: This method validate parameter values, if one of the parameter is null or empty then the skip alert uses
default values.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 dialogpublic void loadAd()
public void loadAd(@NonNull java.lang.String bidResponse)
bidResponse
- oRTB response of format - oRTB-2.5@Nullable public POBImpression getImpression()
@Nullable public POBRequest getAdRequest()
public void show()
public void show(@Nullable java.util.Map<java.lang.String,java.lang.Object> customData)
Note: Calling this method has no effect until the ad is received i.e. onAdReceived() gets called.
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. For example:
HashMapNote: In case multiple rewards are configured then passing the selected reward is mandatory. Else, OW SDK will consider any random reward from the configured rewards.customDataMap = new HashMap (1); List availableRewards = owRewardedAd.getAvailableRewards(); if(availableRewards != null && availableRewards.size()>0) { // Use your own logic for reward selection customDataMap.put(OpenWrapSDK.KEY_SELECTED_REWARD, availableRewards.get(0)); } owRewardedAd.show(customDataMap);
@Nullable public java.util.List<POBReward> getAvailableRewards()
public boolean isReady()
public void destroy()
public void setBidEventListener(@Nullable POBBidEventListener bidEventListener)
setBidEventListener
in interface POBBidEvent
bidEventListener
- reference of POBBidEventListenerpublic boolean proceedToLoadAd()
POBBidEvent
POBBidEventListener
is set
Note: Should be called from Main/UI thread. Also, unnecessary duplicate call will fail and
appropriate errors will be logged with return value `false`proceedToLoadAd
in interface POBBidEvent
public void proceedOnError(@NonNull POBBidEvent.BidEventError error, @NonNull java.lang.String errorMessage)
POBBidEvent
Proceeds with error, If integration type is of primary ad server case like DFP and MoPub, the execution is continued by invoking ad server call ignoring OpenWrap's bid. In case of No ad server integration, flow is completed by setting its state to default considering error at client side. Note: Should be called from Main/UI thread
proceedOnError
in interface POBBidEvent
error
- the error of type POBBidEvent.BidEventError
Example:
Scenario 1 : When bid is failed in client-side in-app auction loss
proceedOnError(BidEventError#CLIENT_SIDE_AUCTION_LOSS);
Scenario 2 : When bid is expired proceedOnError(BidEventError#BID_EXPIRED);
errorMessage
- custom description for the error
Example:
When the bid is failed in client-side application the publisher
can pass on custom message to identify the issue in logs@Nullable public POBBid getBid()
getBid
in interface POBBidEvent