Rewarded video is a full-screen video ad. Users can get rewards after watching the video. At present, the forms of Pangle rewarded video ads can:
Create an app and reward video ad placement on Pangle platform
Orienation
: Select the orientation of the video.Reward amount
: Enter the number of reward items the user will receive. Must be a whole number.Reward item
: Enter the name of reward item the user will receive. Examples: Coins, extra livesReward deliver setting
:Validate each completed rewarded video ad view by the third-party server and ensure you're only rewarding users who have actually finished watching the video in your app.The main steps to integrate rewarded video ads are:
Loading an ad is accomplished using the loadRewardVideoAd()
method on the TTAdNative
class. The loadRewardVideoAd()
method requires a AdSlot
Object and a RewardVideoAdListener
to be notified when ad loading succeeds or fails. The loaded TTRewardVideoAd
object is provided as a parameter in the onRewardVideoAdLoad(TTRewardVideoAd ad)
callback.
TTAdNative
is a Ad Loading Manager. It is recommended to be the member variable of the Activity. You always need to create a TTAdNative
Object before loading ads.
In this section, you need to pass ad placement id in the method setCodeId()
.
Calling the loadRewardVideoAd()
method on the TTAdNative
class to load a Rewarded Video Ad.
RewardVideoAdListener callback | Description |
onError | This method is invoked when an ad fails to load. It includes an error parameter of type Error that indicates what type of failure occurred. For more information, refer to the ErrorCode section |
onRewardVideoCached | This method is executed when the video file has finished loading |
onRewardVideoAdLoad | This method is executed when an ad material is loaded successfully. |
Before the ad to be shown, you need to register ad event callbacks. Passing a RewardAdInteractionListener
object to the setter on your ad. The RewardAdInteractionListener
provides some Ad Event methods to get notifications of rewarded ad events. Each of the methods in RewardAdInteractionListener
corresponds to an event in the lifecycle of a rewarded video ad.
RewardAdInteractionListener callback | Description |
onAdVideoBarClick | This method is invoked when the rewarded ad is clicked by the user. |
onAdClose | This method is invoked when the rewarded ad is closed due to the user tapping on the close icon on the endcard. |
onVideoComplete | This method is invoked when the video has finished playing. |
onVideoError | This method is invoked when an ad fails to display. |
onRewardVerify | The method is invoked when the user should be rewarded. Parameter: |
onSkippedVideo | The method is invoked when the user skipped the video. |
onAdShow | This method is invoked when the ad is displayed, covering the device's screen. |
Before displaying a rewarded video ad to users, you must present the user with an choice to view rewarded ad in exchange for a reward. Rewarded ads must always be an opt-in experience.
To show a rewarded video ad, we recommend to use the onRewardVideoCached()
method to verify if it's finished loading, then call showRewardVideoAd()
on TTRewardVideoAd
. The showRewardVideoAd()
method requires Activity
instance. The Activity instance should be the activity from which the rewarded ad is presented.
A best practice is to load another rewarded video ad in the onAdClose()
method on RewardAdInteractionListener
so that the next rewarded video ad starts loading as soon as the previous one is closed:
Now you have finished the integration. If you wanna test your apps, make sure you use test ads rather than live, production ads. The easiest way to load test ads is to use test mode. It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging.
Refer to the How to add a test device? to add your device to the test devices on Pangle platform.
Note:The Server-side verification is not necessary. Server-side verification acts as an additional layer of validation for rewarded ad views in your app. It’s performed in addition to the standard client-side callback. You can use server-side verification to validate each completed rewarded video ad view and ensure you're only rewarding users who have actually finished watching the video in your app.
The server-side verification callback will append query parameters to your postback url describing the rewarded video interaction:user_id=%s&trans_id=%s&reward_name=%s&reward_amount=%d&extra=%s&sign=%s
Field Name | Field Definition | Field Type | Remarks |
sign | signSignature of the request | string | Signature of the request guarantees security |
user_id | User id | string | App's unique user identifier, it depends on what you entered via SDK. |
trans_id | Transaction id | string | Unique transaction ID for completing viewing the ad |
reward_amount | number of rewards | int | Pangle platform configuration |
reward_name | Name of rewards | string | Pangle platform configuration |
extra | Extra | string | Call SDK input and pass-through,leave it empty if not needed. |
appSecurityKey
: The key you get for adding rewarded video ad code bit on the Pangle NetworktransId
: transaction idsign
: sha256(appSecurityKey:transId)Python sample:
Returns json data with the following fields:
Field Definition | Field Name | Field Type | Remarks |
isValid | Validation result | BOOL | determines the result, whether to award or not |
Instance: