Integrate with Enhance - Native Android
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.
Example Usage
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()
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
)
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
)
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
)
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).
Interfaces
interface Enhance.RewardCallback { void onRewardGranted( int rewardValue, Enhance.RewardType rewardType ); void onRewardDeclined(); void onRewardUnavailable(); }
Properties
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.