i've been searching for hours now, and i can't get a simple interstitial ad to display. the layout is within a fragment and i'm sure that's part of the problem, but i can't find a work around. any help is greatly appreciated - most of what i see is displaying the ad within an activity.
I want the interstitial to appear before the user clicks on a button in an app. i'm sure the issue is with the (this) but I can't find anything.
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("example ad unit");
mapFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
} else {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(Constants.MAPS_INTENT_URI));
startActivity(intent);
}
});