Last active
May 2, 2022 05:59
-
-
Save saymanrifat/93ddf5318b488f1cdaf199f08bbdb68b to your computer and use it in GitHub Desktop.
Best Way to set interstitial ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button button = findViewById(R.id.showAds); | |
button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
if (mInterstitialAd != null) { | |
mInterstitialAd.show(MainActivity.this); | |
mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback(){ | |
//Ads Dismissed here | |
@Override | |
public void onAdDismissedFullScreenContent() { | |
Intent intent = new Intent(FirstActivity.this,SecondActivity.class); | |
startActivity(intent); | |
//Load your Ads Again | |
} | |
}); | |
} else { | |
Intent intent = new Intent(FirstActivity.this,SecondActivity.class); | |
startActivity(intent); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment