com.google.android.gms.ads.rewarded.RewardItem Java Examples
The following examples show how to use
com.google.android.gms.ads.rewarded.RewardItem.
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: SampleMediationRewardedAdEventForwarder.java From googleads-mobile-android-mediation with Apache License 2.0 | 6 votes |
@Override public void onAdRewarded(final String rewardType, final int amount) { RewardItem rewardItem = new RewardItem() { @Override public String getType() { return rewardType; } @Override public int getAmount() { return amount; } }; rewardedAdCallback.onUserEarnedReward(rewardItem); }
Example #2
Source File: SampleCustomEventRewardedAdLoader.java From googleads-mobile-android-mediation with Apache License 2.0 | 6 votes |
@Override public void onAdRewarded(final String rewardType, final int amount) { RewardItem rewardItem = new RewardItem() { @Override public String getType() { return rewardType; } @Override public int getAmount() { return amount; } }; rewardedAdCallback.onUserEarnedReward(rewardItem); }
Example #3
Source File: MoPubMediationAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 6 votes |
@Override public void onRewardedVideoCompleted(@NonNull Set<String> adUnitIds, @NonNull final MoPubReward reward) { Preconditions.checkNotNull(reward); if (mRewardedAdCallback != null) { mRewardedAdCallback.onVideoComplete(); mRewardedAdCallback.onUserEarnedReward(new RewardItem() { @Override public String getType() { return reward.getLabel(); } @Override public int getAmount() { return reward.getAmount(); } }); } }
Example #4
Source File: VerizonMediaRewardedRenderer.java From googleads-mobile-android-mediation with Apache License 2.0 | 6 votes |
@Override public void onEvent(final InterstitialAd interstitialAd, final String source, final String eventId, final Map<String, Object> arguments) { if (VIDEO_COMPLETE_EVENT_ID.equals(eventId) && !completionEventCalled.getAndSet(true)) { ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { if (mediationRewardedAdCallback != null) { mediationRewardedAdCallback.onVideoComplete(); mediationRewardedAdCallback.onUserEarnedReward(new RewardItem() { @Override public String getType() { return ""; } @Override public int getAmount() { return 1; } }); } } }); } }
Example #5
Source File: MainActivity.java From googleads-mobile-android-examples with Apache License 2.0 | 5 votes |
private void showRewardedVideo() { showVideoButton.setVisibility(View.INVISIBLE); if (rewardedAd.isLoaded()) { RewardedAdCallback adCallback = new RewardedAdCallback() { @Override public void onRewardedAdOpened() { // Ad opened. Toast.makeText(MainActivity.this, "onRewardedAdOpened", Toast.LENGTH_SHORT).show(); } @Override public void onRewardedAdClosed() { // Ad closed. Toast.makeText(MainActivity.this, "onRewardedAdClosed", Toast.LENGTH_SHORT).show(); // Preload the next rewarded ad. MainActivity.this.loadRewardedAd(); } @Override public void onUserEarnedReward(RewardItem rewardItem) { // User earned reward. Toast.makeText(MainActivity.this, "onUserEarnedReward", Toast.LENGTH_SHORT).show(); addCoins(rewardItem.getAmount()); } @Override public void onRewardedAdFailedToShow(int errorCode) { // Ad failed to display Toast.makeText(MainActivity.this, "onRewardedAdFailedToShow", Toast.LENGTH_SHORT) .show(); } }; rewardedAd.show(this, adCallback); } }
Example #6
Source File: MainActivity.java From googleads-mobile-android-examples with Apache License 2.0 | 5 votes |
private void showRewardedVideo() { showVideoButton.setVisibility(View.INVISIBLE); if (rewardedAd.isLoaded()) { RewardedAdCallback adCallback = new RewardedAdCallback() { @Override public void onRewardedAdOpened() { // Ad opened. Toast.makeText(MainActivity.this, "onRewardedAdOpened", Toast.LENGTH_SHORT).show(); } @Override public void onRewardedAdClosed() { // Ad closed. Toast.makeText(MainActivity.this, "onRewardedAdClosed", Toast.LENGTH_SHORT).show(); // Preload the next video ad. MainActivity.this.loadRewardedAd(); } @Override public void onUserEarnedReward(RewardItem rewardItem) { // User earned reward. Toast.makeText(MainActivity.this, "onUserEarnedReward", Toast.LENGTH_SHORT).show(); addCoins(rewardItem.getAmount()); } @Override public void onRewardedAdFailedToShow(int errorCode) { // Ad failed to display Toast.makeText(MainActivity.this, "onRewardedAdFailedToShow", Toast.LENGTH_SHORT) .show(); } }; rewardedAd.show(this, adCallback); } }