Skip to content

Instantly share code, notes, and snippets.

@tsiougkosn
Created July 7, 2015 14:39
Show Gist options
  • Save tsiougkosn/3ac6e58f330487090e80 to your computer and use it in GitHub Desktop.
Save tsiougkosn/3ac6e58f330487090e80 to your computer and use it in GitHub Desktop.
Avocarrot Interstitial Close Reason
AvocarrotInterstitial interstitial = new AvocarrotInterstitial(this, "api key", "Placement key");
interstitial.setSandbox(true);
interstitial.setLogger(true, "ALL");
interstitial.setListener(new AvocarrotInterstitialListener() {
boolean isClicked = false;
@Override
public void onAdDisplayed() {
super.onAdDisplayed();
isClicked = false;
}
@Override
public void onAdClicked() {
super.onAdClicked();
isClicked = true;
}
@Override
public void onAdDismissed() {
super.onAdDismissed();
if (isClicked) {
Toast.makeText(MainActivity.this, "Closing because : Click the ad", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, "Closing because : Click x OR back btn", Toast.LENGTH_SHORT).show();
}
}
});
interstitial.loadAndShowAd();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment