Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- getSupportActionBar().hide();
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
- setContentView(R.layout.activity_main);
- ///////////////////////////////
- //MobileAds.initialize(this,"ca-app-pub-3940256099942544/5224354917");
- MobileAds.initialize(this, new OnInitializationCompleteListener() {
- @Override
- public void onInitializationComplete(InitializationStatus initializationStatus) {
- //RewardedAd.load();
- }
- });
- AdRequest adRequest = new AdRequest.Builder().build();
- //ca-app-pub-6779580915401561/1392653660
- RewardedAd.load(this, "ca-app-pub-3940256099942544/5224354917",
- adRequest, new RewardedAdLoadCallback(){
- @Override
- public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
- // Handle the error.
- Log.d(TAG, loadAdError.getMessage());
- mRewardedAd = null;
- }
- @Override
- public void onAdLoaded(@NonNull RewardedAd rewardedAd) {
- mRewardedAd = rewardedAd;
- Log.d(TAG, "Ad was loaded.");
- }
- });
- mRewardedAd.setFullScreenContentCallback(new FullScreenContentCallback() {
- @Override
- public void onAdShowedFullScreenContent() {
- // Called when ad is shown.
- Log.d(TAG, "Ad was shown.");
- mRewardedAd = null;
- }
- @Override
- public void onAdFailedToShowFullScreenContent(AdError adError) {
- // Called when ad fails to show.
- Log.d(TAG, "Ad failed to show.");
- }
- @Override
- public void onAdDismissedFullScreenContent() {
- // Called when ad is dismissed.
- // Don't forget to set the ad reference to null so you
- // don't show the ad a second time.
- Log.d(TAG, "Ad was dismissed.");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement