Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ** MobileAds.initialize(getApplicationContext(),"ca-app-pub-4786107620829013~6803627405");
- mad = MobileAds.getRewardedVideoAdInstance(this);
- mad.setRewardedVideoAdListener(this);
- mad.loadAd("ca-app-pub-xxxxxxxxxxx", new AdRequest.Builder().build());
- public void Clicked(View view) {
- if (mad.isLoaded())
- {
- mad.show();
- }
- }
- @Override
- public void onRewardedVideoAdLoaded() {
- Toast.makeText(this, "Video loaded", Toast.LENGTH_SHORT).show();
- }
- @Override
- public void onRewardedVideoAdOpened() {
- Toast.makeText(this, "Video Opened", Toast.LENGTH_SHORT).show();
- }
- @Override
- public void onRewardedVideoStarted() {
- Toast.makeText(this, "Video Started", Toast.LENGTH_SHORT).show();
- }
- @Override
- public void onRewardedVideoAdClosed() {
- }
- @Override
- public void onRewarded(RewardItem rewardItem) {
- }
- @Override
- public void onRewardedVideoAdLeftApplication() {
- }
- @Override
- public void onRewardedVideoAdFailedToLoad(int i) {
- Toast.makeText(this, "Fail", Toast.LENGTH_SHORT).show();
- }
- @Override
- public void onRewardedVideoCompleted() {
- Toast.makeText(this, "Complete Video", Toast.LENGTH_SHORT).show();
- }**
Add Comment
Please, Sign In to add comment