com.google.android.gms.ads.reward.RewardedVideoAd Java Examples
The following examples show how to use
com.google.android.gms.ads.reward.RewardedVideoAd.
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: RewardVideoExecutor.java From cordova-plugin-admob-free with MIT License | 6 votes |
public PluginResult showAd(final boolean show, final CallbackContext callbackContext) { if (rewardedVideoAd == null) { return new PluginResult(PluginResult.Status.ERROR, "rewardedVideoAd is null, call createRewardVideo first."); } CordovaInterface cordova = plugin.cordova; cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { if (rewardedVideoAd instanceof RewardedVideoAd) { RewardedVideoAd rvad = rewardedVideoAd; if (rvad.isLoaded()) { rvad.show(); } } if (callbackContext != null) { callbackContext.success(); } } }); return null; }
Example #2
Source File: AdMobPlugin.java From cordova-admob-pro with MIT License | 6 votes |
@Override protected Object __prepareRewardVideoAd(String adId) { // safety check to avoid exceptoin in case adId is null or empty if(adId==null || adId.length()==0) adId = TEST_REWARDVIDEO_ID; RewardedVideoAd ad = MobileAds.getRewardedVideoAdInstance(getActivity()); ad.setRewardedVideoAdListener(new RewardVideoListener()); synchronized (mLock) { if (!mIsRewardedVideoLoading) { mIsRewardedVideoLoading = true; Bundle extras = new Bundle(); extras.putBoolean("_noRefresh", true); AdRequest adRequest = new AdRequest.Builder() .addNetworkExtrasBundle(AdMobAdapter.class, extras) .build(); ad.loadAd(adId, adRequest); } } return ad; }
Example #3
Source File: GenerateShortcutHelper.java From TvAppRepo with Apache License 2.0 | 5 votes |
static void showVideoAd(Activity activity) { final RewardedVideoAd ad = MobileAds.getRewardedVideoAdInstance(activity); ad.setRewardedVideoAdListener(new RewardedVideoAdListener() { @Override public void onRewardedVideoAdLoaded() { ad.show(); } @Override public void onRewardedVideoAdOpened() { } @Override public void onRewardedVideoStarted() { } @Override public void onRewardedVideoAdClosed() { } @Override public void onRewarded(RewardItem rewardItem) { } @Override public void onRewardedVideoAdLeftApplication() { } @Override public void onRewardedVideoAdFailedToLoad(int i) { } }); ad.loadAd(activity.getString(R.string.reward_video_ad_unit_id), new AdRequest.Builder().build()); }
Example #4
Source File: AdMobPlugin.java From cordova-admob-pro with MIT License | 5 votes |
@Override protected void __showRewardVideoAd(Object rewardvideo) { if(rewardvideo == null) return; if(rewardvideo instanceof RewardedVideoAd) { RewardedVideoAd ad = (RewardedVideoAd) rewardvideo; if(ad.isLoaded()){ ad.show(); } } }