com.google.android.gms.ads.rewarded.RewardedAdLoadCallback Java Examples

The following examples show how to use com.google.android.gms.ads.rewarded.RewardedAdLoadCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
private void requestAdapterRewardedAd() {
  RewardedAdLoadCallback adLoadCallback = new RewardedAdLoadCallback() {
    @Override
    public void onRewardedAdLoaded() {
      adapterRewardedButton.setEnabled(true);
    }

    @Override
    public void onRewardedAdFailedToLoad(int errorCode) {
      Toast.makeText(MainActivity.this,
          String.format("Rewarded ad failed to load with code %d", errorCode),
          Toast.LENGTH_LONG).show();
      adapterRewardedButton.setEnabled(true);
    }
  };
  rewardedAd = new RewardedAd(this, getString(R.string.adapter_rewarded_ad_unit_id));
  rewardedAd.loadAd(new AdRequest.Builder().build(), adLoadCallback);
}
 
Example #2
Source File: MainActivity.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
private void requestCustomEventRewardedAd() {
  RewardedAdLoadCallback adLoadCallback = new RewardedAdLoadCallback() {
    @Override
    public void onRewardedAdLoaded() {
      customEventRewardedButton.setEnabled(true);
    }

    @Override
    public void onRewardedAdFailedToLoad(int errorCode) {
      Toast.makeText(MainActivity.this,
          String.format("Rewarded ad failed to load with code %d", errorCode),
          Toast.LENGTH_LONG).show();
      customEventRewardedButton.setEnabled(true);
    }
  };
  customEventRewardedAd = new RewardedAd(this,
      getString(R.string.customevent_rewarded_ad_unit_id));
  customEventRewardedAd.loadAd(new AdRequest.Builder().build(), adLoadCallback);
}