Overview
Rewarded ads are full-screen video ads that provide rewards such as in-game currency, lives, or hints when users watch the video to completion.Key Features
- Full-screen video ads
- Rewards only provided when user completely watches the ad
- User chooses to watch ad (e.g., “Watch video to get lives” button)
- Configurable reward type and amount
Use test unit ID in development environment:
PUBLIC_TEST_UNIT_ID_REWARDEDImplementation Steps
Implement rewarded ads in the following steps:- Create AdropRewardedAd Instance - Create ad object with unit ID
- Set Delegate - Set delegate to handle ad events
- Load Ad - Request ad using
load()method - Show Ad - Display ad using
show()method and handle rewards
Swift Example
Basic Implementation
SwiftUI Example
Objective-C Example
Delegate Methods
Required Methods
Called when ad is received successfully. You can show the ad using
show() method from this point.Called when ad fails to load. You can check the cause of failure through the error code.
Optional Methods
Called when ad impression is recorded and sent.
Called when user clicks the ad.
Called just before the ad screen is displayed. You can pause background music, etc.
Called after the ad screen is fully displayed.
Called just before the ad screen is dismissed.
Called after the ad screen is fully dismissed. You can resume background music or preload the next ad.
Called when ad fails to show. You can check the cause of failure through the error code.
Closure Callbacks
As an alternative to delegates, you can use closure-based callbacks.If both a delegate and closures are set, both will be called.
Reward Handling
Reward Callback
Pass the reward callback through theuserDidEarnRewardHandler parameter of the show() method.
Reward Type and Amount
- type: Reward type set in Ad Control Console (integer value)
- amount: Reward amount set in Ad Control Console (integer value)
Server-Side Verification
Server-side verification (SSV) allows you to verify reward grants on your server, preventing client-side manipulation. UseAdropServerSideVerificationOptions to pass user identification and custom data that will be included in the server-to-server callback.
To receive SSV callbacks on your server, register a callback URL in the console: [Management] > [Integrations] > Reward Ad SSV. The
userId and customData set here are included in the encrypted payload sent to that URL. See the Reward Ad SSV guide for payload decryption and setup.Setting Up SSV
AdropServerSideVerificationOptions
| Property | Type | Description |
|---|---|---|
userId | String? | User identifier for server-side verification |
customData | String? | Custom data string to include in the callback |
Set
serverSideVerificationOptions before calling load(). The userId and customData values are sent to your server callback URL when the user earns a reward.Best Practices
1. Preload Ads
Preload ads for better user experience.2. Check Ad Ready State
Check if ad is loaded and update UI.3. Background Music Handling
Control background music appropriately before and after showing ads.4. Error Handling
Implement retry logic when ad loading fails.5. Memory Management
Clean up ad object when ViewController is deallocated.Testing
Test Unit ID
Always use a test unit ID during development.Managing Unit IDs by Environment
Automatically switch unit IDs based on build configuration.Related Documentation
Interstitial Ads
Interstitial ad implementation guide
Error Codes
AdropErrorCode reference
Example Project
View complete example code