当前位置: 首页>>代码示例>>Java>>正文


Java RewardItem类代码示例

本文整理汇总了Java中com.google.android.gms.ads.reward.RewardItem的典型用法代码示例。如果您正苦于以下问题:Java RewardItem类的具体用法?Java RewardItem怎么用?Java RewardItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RewardItem类属于com.google.android.gms.ads.reward包,在下文中一共展示了RewardItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
		public void onRewarded(RewardItem reward) {
			Log.d(LOG_TAG, String.format("%s", "onRewarded"));
		  
/*
      String obj = __getProductShortName();
      String json = String.format("{'adNetwork':'%s','adType':'%s','adEvent':'%s','rewardType':'%s','rewardAmount':%d}",
              obj, ADTYPE_REWARDVIDEO, EVENT_AD_PRESENT, reward.getType(), reward.getAmount());
*/			  
		  
			PluginResult pr = new PluginResult(PluginResult.Status.OK, "onRewardedVideoAdCompleted");
			pr.setKeepCallback(true);
			plugin.getCallbackContextKeepCallback().sendPluginResult(pr);
			//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
			//pr.setKeepCallback(true);
			//callbackContextKeepCallback.sendPluginResult(pr);				  
		}
 
开发者ID:cranberrygame,项目名称:cordova-plugin-ad-admob,代码行数:18,代码来源:AdMobOverlap.java

示例2: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem rewardItem) {
    //you get a reward

    DemoHelperClass demoHelperClass = new DemoHelperClass(getApplicationContext());
    SQLiteDatabase sqLiteDatabase = demoHelperClass.getWritableDatabase();

    final List listgems = demoHelperClass.getGems();
    int gemstext = (Integer) listgems.get(listgems.size() - 1);

    int plusOneGem = 1;
    gemstext = gemstext + plusOneGem;
    demoHelperClass.InsertGems(gemstext);
    gemsText.setText(String.valueOf(gemstext));

    //Show text that +1 gem added in bucket
    Toast toast = Toast.makeText(getApplicationContext(), "+1 gem added in your bucket.", Toast.LENGTH_LONG);
    toast.getView().setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.darkpink));
    TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
    v.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.white));
    v.setTypeface(openSansSemiBold);
    v.setTextSize(10);
    toast.show();


    sqLiteDatabase.close();
    listgems.clear();
}
 
开发者ID:sarveshchavan7,项目名称:Trivia-Knowledge,代码行数:29,代码来源:MainGameActivity.java

示例3: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem reward) {
    mCatChatTextView.setText(getString(R.string.on_rewarded));
    mCatStatus.pat(reward.getAmount());
    mCatStatus.increaseFood();
    Toast.makeText(this, "Intimacy increased.", Toast.LENGTH_SHORT).show();
    Toast.makeText(this, "Got 1 food.", Toast.LENGTH_SHORT).show();
    updateCatStatusTextViews();
}
 
开发者ID:miemiekismet,项目名称:IdleCat,代码行数:10,代码来源:DisplayCatActivity.java

示例4: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem reward) {
    Toast.makeText(this,
            String.format(" onRewarded! currency: %s amount: %d", reward.getType(),
                    reward.getAmount()),
            Toast.LENGTH_SHORT).show();
    //do the reward ///
}
 
开发者ID:HitRoxxx,项目名称:FloatingNew,代码行数:9,代码来源:SplashScreen.java

示例5: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem reward) {
    JSONObject data = new JSONObject();
    try {
        data.put("adType", executor.getAdType());
        data.put("rewardType", reward.getType());
        data.put("rewardAmount", reward.getAmount());
    } catch (JSONException e) {
        e.printStackTrace();
    }
    executor.fireAdEvent("admob.rewardvideo.events.REWARD", data);
}
 
开发者ID:ratson,项目名称:cordova-plugin-admob-free,代码行数:13,代码来源:RewardVideoListener.java

示例6: showVideoAd

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
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());
}
 
开发者ID:ITVlab,项目名称:TvAppRepo,代码行数:41,代码来源:GenerateShortcutHelper.java

示例7: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem reward) {
    Toast.makeText(this,
            String.format(" onRewarded! currency: %s amount: %d", reward.getType(),
                    reward.getAmount()),
            Toast.LENGTH_SHORT).show();
    addCoins(reward.getAmount());
}
 
开发者ID:googlesamples,项目名称:android-ads,代码行数:9,代码来源:MainActivity.java

示例8: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem rewardItem) {
    WritableMap reward = Arguments.createMap();

    reward.putInt("amount", rewardItem.getAmount());
    reward.putString("type", rewardItem.getType());

    sendEvent(EVENT_REWARDED, reward);
}
 
开发者ID:sbugert,项目名称:react-native-admob,代码行数:10,代码来源:RNAdMobRewardedVideoAdModule.java

示例9: createRewardedVideo

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
public RewardedVideoAd createRewardedVideo(final String unitid) {
	RewardedVideoAd mrv = MobileAds.getRewardedVideoAdInstance(activity);
	mrv.setRewardedVideoAdListener(new RewardedVideoAdListener() {

		@Override
		public void onRewardedVideoAdLoaded() {
			Utils.d("AdMob:Video:Loaded");
			Utils.callScriptFunc("AdMob", "AdMob_Video", buildStatus(unitid, "loaded"));
		}

		@Override
		public void onRewarded(RewardItem rewardItem) {
			Utils.d("AdMob:Rewarded:Success");

			Dictionary ret = new Dictionary();
			ret.put("RewardType", rewardItem.getType());
			ret.put("RewardAmount", rewardItem.getAmount());
			ret.put("unit_id", unitid);

			Utils.callScriptFunc("AdMob", "AdMobReward", ret);
			reloadRewardedVideo(unitid);
		}

		@Override
		public void onRewardedVideoAdFailedToLoad(int errorCode) {
			Utils.d("AdMob:VideoLoad:Failed");
			Utils.callScriptFunc("AdMob", "AdMob_Video", buildStatus(unitid, "load_failed"));
			reloadRewardedVideo(unitid);
		}

		@Override
		public void onRewardedVideoAdClosed() {
			Utils.d("AdMob:VideoAd:Closed");
			Utils.callScriptFunc("AdMob", "AdMob_Video", buildStatus(unitid, "closed"));
			reloadRewardedVideo(unitid);
		}

		@Override
		public void onRewardedVideoAdLeftApplication() {
			Utils.d("AdMob:VideoAd:LeftApp");
		}

		@Override
		public void onRewardedVideoAdOpened() {
			Utils.d("AdMob:VideoAd:Opended");
			//Utils.callScriptFunc("AdMob", "AdMob_Video", buildStatus(unitid, "opened"));
		}

		@Override
		public void onRewardedVideoStarted() {
			Utils.d("Reward:VideoAd:Started");
			//Utils.callScriptFunc("AdMob", "AdMob_Video", buildStatus(unitid, "started"));
		}
	});

	return mrv;
}
 
开发者ID:FrogSquare,项目名称:GodotFireBase,代码行数:58,代码来源:AdMob.java

示例10: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem rewardItem) {
    TDGalaxy.preferences.changePref("money", TDGalaxy.preferences.getMoney() + 100);
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:5,代码来源:AndroidLauncher.java

示例11: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem reward) {
    mRewardItem = reward;
}
 
开发者ID:googlecodelabs,项目名称:monetizationcodelab,代码行数:5,代码来源:FailActivity.java

示例12: onRewarded

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
public void onRewarded(RewardItem reward) {
    mRewardItem = reward;
    mFirebaseAnalytics.setUserProperty("reward_amount", new Integer(reward.getAmount()).toString());
}
 
开发者ID:googlecodelabs,项目名称:monetizationcodelab,代码行数:6,代码来源:FailActivity.java

示例13: loadAndshowRewardedVideo

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
private Single<Boolean> loadAndshowRewardedVideo(final String id) {
    return Single.create(new SingleOnSubscribe<Boolean>() {
        @Override
        public void subscribe(@NonNull final SingleEmitter<Boolean> e) throws Exception {
            final RewardedVideoAd mAd = MobileAds.getRewardedVideoAdInstance(application);
            mAd.setRewardedVideoAdListener(new RewardedVideoAdListener() {

                boolean rewarded = false;

                @Override
                public void onRewardedVideoAdLoaded() {
                    mAd.show();
                }

                @Override
                public void onRewardedVideoAdOpened() {

                }

                @Override
                public void onRewardedVideoStarted() {

                }

                @Override
                public void onRewardedVideoAdClosed() {
                    e.onSuccess(rewarded);
                }

                @Override
                public void onRewarded(RewardItem rewardItem) {
                    rewarded = true;
                }

                @Override
                public void onRewardedVideoAdLeftApplication() {

                }

                @Override
                public void onRewardedVideoAdFailedToLoad(int i) {
                    e.onError(new AdError());
                }
            });

            final AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
            adRequestBuilder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
            if (debug) {
                adRequestBuilder.addTestDevice(DeviceIdFounder.getDeviceId(application));
            }

            mAd.loadAd(id, adRequestBuilder.build());
        }
    });
}
 
开发者ID:florent37,项目名称:AdsManager,代码行数:56,代码来源:AdsManager.java

示例14: createRewardedVideo

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
public void createRewardedVideo() {
	mrv = MobileAds.getRewardedVideoAdInstance(activity);
	mrv.setRewardedVideoAdListener(new RewardedVideoAdListener() {

		@Override
		public void onRewardedVideoAdLoaded() {
			Utils.d("AdMob:Video:Loaded");
			//emitRewardedVideoStatus();
			//Utils.call
		}

		@Override
		public void onRewarded(RewardItem rewardItem) {
			Utils.d("AdMob:Rewarded");

			JSONObject ret = new JSONObject();
			try {
				ret.put("RewardType", rewardItem.getType());
				ret.put("RewardAmount", rewardItem.getAmount());
			} catch (JSONException e) {
				Utils.d("AdMob:Reward:Error:" + e.toString());
			}

			Utils.callScriptFunc("AdMob", "AdMobReward", ret.toString());
		}

		@Override
		public void onRewardedVideoAdFailedToLoad(int errorCode) {
			Utils.d("AdMob:VideoLoad:Failed");
			Utils.callScriptFunc("AdMob", "AdMob_Video", "load_failed");
		}

		@Override
		public void onRewardedVideoAdClosed() {
			Utils.d("AdMob:VideoAd:Closed");
		}

		@Override
		public void onRewardedVideoAdLeftApplication() {
			Utils.d("AdMob:VideoAd:LeftApp");
		}

		@Override
		public void onRewardedVideoAdOpened() {
			Utils.d("AdMon:VideoAd:Opended");
		}

		@Override
		public void onRewardedVideoStarted() {
			Utils.d("Reward:VideoAd:Started");
		}
	});

	requestNewRewardedVideo();
}
 
开发者ID:FrogSquare,项目名称:GodotAds,代码行数:56,代码来源:AdMob.java

示例15: onCreate

import com.google.android.gms.ads.reward.RewardItem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, getString(R.string.admob_app_id));

    mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);

    // Create the "retry" button, which starts a new game.
    mRetryButton = ((Button) findViewById(R.id.retry_button));
    mRetryButton.setVisibility(View.INVISIBLE);
    mRetryButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startGame();
        }
    });

    // Hide the "watch video" until the end of a game.
    mShowVideoButton = ((Button) findViewById(R.id.watch_video));
    mShowVideoButton.setVisibility(View.INVISIBLE);

    mCoinCountText = ((TextView) findViewById(R.id.coin_count_text));

    mRewardedVideoAd.setRewardedVideoAdListener(new RewardedVideoAdListener() {
        @Override
        public void onRewarded(RewardItem rewardItem) {
            Toast.makeText(getBaseContext(), "Ad triggered reward.", Toast.LENGTH_SHORT).show();
            addCoins(rewardItem.getAmount());
        }

        @Override
        public void onRewardedVideoAdLoaded() {
            Toast.makeText(getBaseContext(), "Ad loaded.", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRewardedVideoAdOpened() {
            Toast.makeText(getBaseContext(), "Ad opened.", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRewardedVideoStarted() {
            Toast.makeText(getBaseContext(), "Ad started.", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRewardedVideoAdClosed() {
            Toast.makeText(getBaseContext(), "Ad closed.", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRewardedVideoAdLeftApplication() {
            Toast.makeText(getBaseContext(), "Ad left application.", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onRewardedVideoAdFailedToLoad(int i) {
            Toast.makeText(getBaseContext(), "Ad failed to load.", Toast.LENGTH_SHORT).show();
        }
    });

    if (savedInstanceState == null) {
        mCoinCount = 0;
        mCoinCountText.setText("Coins: " + mCoinCount);

        startGame();
    }
}
 
开发者ID:googlecodelabs,项目名称:admob-rewarded-video,代码行数:72,代码来源:MainActivity.java


注:本文中的com.google.android.gms.ads.reward.RewardItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。