Android Rewarded Video Configuration

1. Set Up Rewarded Video Ad Delegate Methods

For Java

Yodo1Mas.getInstance().setRewardListener(new Yodo1Mas.RewardListener() {
    @Override
    public void onAdOpened(@NonNull Yodo1MasAdEvent event) {

    }

    @Override
    public void onAdvertRewardEarned(@NonNull Yodo1MasAdEvent event) {

    }

    @Override
    public void onAdError(@NonNull Yodo1MasAdEvent event, @NonNull Yodo1MasError error) {
    
    }
    
    @Override
    public void onAdClosed(@NonNull Yodo1MasAdEvent event) {
        
    }
});

For Kotlin

val rewardListener: RewardListener = object : RewardListener() {
override fun onAdOpened(event: Yodo1MasAdEvent) {

            }
override fun onAdvertRewardEarned(event: Yodo1MasAdEvent) {

            }
override fun onAdError(event: Yodo1MasAdEvent, error: Yodo1MasError) {
                Toast.makeText(this@MainActivity, error.message, Toast.LENGTH_SHORT).show()
            }
override fun onAdClosed(event: Yodo1MasAdEvent) {

            }
}
Yodo1Mas.getInstance().setRewardListener(rewardListener)

2. Check the Loading Status of Rewarded Video Ads

For Java

boolean isLoaded = Yodo1Mas.getInstance().isRewardedAdLoaded();

For Kotlin

val isAdLoaded = Yodo1Mas.getInstance().isRewardedAdLoaded()

3. Show Rewarded Video Ads

For Java

Yodo1Mas.getInstance().showRewardedAd(MyActivity.this);

For Kotlin

Yodo1Mas.getInstance().showRewardedAd(this@MainActivity)
Updated on September 22, 2021

Was this article helpful?

Related Articles