Home





Rewarded Ads

Rewarded Ads are usually full-screen video ads which users can view to receive a reward inside the app, like an additional in-game currency or a health bonus for example.

if(Enhance.isRewardedAdReady()) {
    // The ad is ready, show it
    Enhance.showRewardedAd(new RewardCallback()
    {
        // Callbacks:
        @Override
        public void onRewardGranted(int rewardValue, RewardType rewardType)
        {
            if(rewardType == RewardType.ITEM)
                writeLog("Reward granted (item)");

            else if(rewardType == RewardType.COINS)
                writeLog("Reward granted (coins), value: " + rewardValue);
        }

        @Override
        public void onRewardDeclined()
        {
            writeLog("Reward declined");
        }

        @Override
        public void onRewardUnavailable()
        {
            writeLog("Reward unavailable");
        }   
    });    
}

Methods

Enhance.isRewardedAdReady

boolean Enhance.isRewardedAdReady()

Check if an ad from any of the included SDK providers is ready to be shown.

Return Value:

Returns true if any ad is ready, false otherwise. When app is not Enhanced, always returns true.

Enhance.isRewardedAdReady

boolean Enhance.isRewardedAdReady(
    String placement
)

Check if an ad from any of the included SDK providers is ready to be shown.

Parameters:

String  placement - Specifies the internal placement of the ad (from the Enhance mediation editor).

Return Value:

Returns true if any ad is ready, false otherwise. When app is not Enhanced, always returns true.

Enhance.showRewardedAd

void Enhance.showRewardedAd(
    RewardCallback callback
)

Display an ad if any is currently available. The ad provider is selected based on your app's mediation settings.

Parameters:

RewardCallback  callback - Specifies the callback object which is triggered when a reward is granted, declined or unavailable. (For more information about the RewardCallback type, see the Interfaces section).

Enhance.showRewardedAd

void Enhance.showRewardedAd(
    RewardCallback callback,
    String placement
)

Display an ad if any is currently available. The ad provider is selected based on your app's mediation settings.

Parameters:

RewardCallback  callback - Specifies the callback object which is triggered when a reward is granted, declined or unavailable. (For more information about the RewardCallback type, see the Interfaces section).

String  placement - Specifies the internal placement of the ad (from the Enhance mediation editor).


interface Enhance.RewardCallback { void onRewardGranted( int rewardValue, Enhance.RewardType rewardType ); void onRewardDeclined(); void onRewardUnavailable(); }


String Enhance.PLACEMENT_DEFAULT

The default internal placement of all ad types. Always equal to "default".


Enhance.RewardType.ITEM

Indicates that the granted reward is a game-defined item.


Enhance.RewardType.COINS

Indicates that the granted reward is a specific number of coins.