Overview
Rewarded ads are full-screen video ads that provide users with rewards such as in-game currency, lives, or hints when they watch the ad to completion.Key Features
- Full-screen video ads
- Rewards provided only when users watch the entire ad
- User-initiated ad viewing (e.g., “Watch video to get lives” button)
- Configurable reward type and amount
Use the test unit ID for development:
PUBLIC_TEST_UNIT_ID_REWARDEDImplementation Steps
Rewarded ads are implemented in the following steps:- Create AdropRewardedAd Instance - Create ad object with unit ID
- Set Listener - Configure listener for ad events
- Load Ad - Request ad with
load()method - Show Ad - Display ad with
show()method and handle rewards
Basic Implementation
Kotlin Example
Java Example
AdropRewardedAd Class
Constructor
Activity or Application Context
Ad unit ID issued from the Adrop console
Properties
Ad unit ID (read-only)
Whether the ad is loaded and ready to show (read-only)
Creative ID of the loaded ad (read-only)
Transaction ID of the ad (read-only)
Campaign ID of the ad (read-only)
Whether this is a backfill ad (read-only)
Listener for receiving ad events
Methods
Request an ad. Results are delivered via
onAdReceived or onAdFailedToReceive callbacks.Show the ad.
activity: Activity to display the aduserDidEarnRewardHandler: Reward callback(type: Int, amount: Int) -> Unit
Release ad resources. Must be called in Activity’s
onDestroy().AdropRewardedAdListener Interface
Required Methods
Called when ad is successfully received. You can show the ad with
show() from this point.Called when ad fails to load. Check the error code for the failure reason.
Optional Methods
Called when ad impression is recorded.
Called when user clicks the ad.
Called just before the ad screen is displayed. Good time to pause background music.
Called after the ad screen is fully displayed.
Called just before the ad screen closes.
Called after the ad screen is fully closed. Good time to resume background music or preload next ad.
Called when ad fails to show. Check the error code for the failure reason.
Reward Handling
Reward Callback
Pass a reward callback as theuserDidEarnRewardHandler parameter to the show() method.
Reward Type and Amount
- type: Reward type configured in Adrop console (integer value)
- amount: Reward amount configured in Adrop console (integer value)
Best Practices
1. Preload Ads
Preload ads for better user experience.2. Check Ad Ready State
Check if ad is loaded and update UI accordingly.3. Background Music Handling
Control background music appropriately before and after ad display.4. Error Handling
Implement retry logic when ad loading fails.5. Lifecycle Management
Clean up ad resources when Activity is destroyed.Complete Example
Testing
Test Unit ID
Always use test unit IDs during development.Environment-based Unit ID Management
Automatically switch unit IDs based on build type.Backfill Ads
When backfill ads are enabled, backfill ads are automatically loaded when direct ads are unavailable. Use theisBackfilled property to check if the ad is a backfill ad.
To use backfill ads, add the
io.adrop:adrop-ads-backfill dependency. See Getting Started.Server-Side Verification
Server-side verification (SSV) allows you to verify reward grants on your server, preventing client-side manipulation. UseServerSideVerificationOptions 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
ServerSideVerificationOptions
| 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.Related Documentation
Interstitial Ads
Interstitial ad implementation guide
Error Codes
AdropErrorCode reference
Examples
View complete example code