Skip to main content

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_REWARDED

Implementation Steps

Rewarded ads are implemented in the following steps:
  1. Create AdropRewardedAd Instance - Create ad object with unit ID
  2. Set Listener - Configure listener for ad events
  3. Load Ad - Request ad with load() method
  4. Show Ad - Display ad with show() method and handle rewards

Basic Implementation

Kotlin Example

Java Example


AdropRewardedAd Class

Constructor

Context
Activity or Application Context
String
Ad unit ID issued from the Adrop console

Properties

String
Ad unit ID (read-only)
Boolean
Whether the ad is loaded and ready to show (read-only)
String
Creative ID of the loaded ad (read-only)
String
Transaction ID of the ad (read-only)
String
Campaign ID of the ad (read-only)
Boolean
Whether this is a backfill ad (read-only)
AdropRewardedAdListener?
Listener for receiving ad events

Methods

Unit
Request an ad. Results are delivered via onAdReceived or onAdFailedToReceive callbacks.
Unit
Show the ad.
  • activity: Activity to display the ad
  • userDidEarnRewardHandler: Reward callback (type: Int, amount: Int) -> Unit
Unit
Release ad resources. Must be called in Activity’s onDestroy().

AdropRewardedAdListener Interface

Required Methods

void
Called when ad is successfully received. You can show the ad with show() from this point.
void
Called when ad fails to load. Check the error code for the failure reason.

Optional Methods

void
Called when ad impression is recorded.
void
Called when user clicks the ad.
void
Called just before the ad screen is displayed. Good time to pause background music.
void
Called after the ad screen is fully displayed.
void
Called just before the ad screen closes.
void
Called after the ad screen is fully closed. Good time to resume background music or preload next ad.
void
Called when ad fails to show. Check the error code for the failure reason.

Reward Handling

Reward Callback

Pass a reward callback as the userDidEarnRewardHandler 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.
Testing with actual unit IDs may be considered invalid traffic and could result in account suspension. Always use test unit IDs.

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 the isBackfilled 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. Use ServerSideVerificationOptions 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

Set serverSideVerificationOptions before calling load(). The userId and customData values are sent to your server callback URL when the user earns a reward.

Interstitial Ads

Interstitial ad implementation guide

Error Codes

AdropErrorCode reference

Examples

View complete example code