Created
February 12, 2017 10:23
-
-
Save ayltai/37200436bd4748cce819e3a1bbd37012 to your computer and use it in GitHub Desktop.
Fetch ad for AdMob
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
@Override | |
public void fetchAd() { | |
new AdLoader.Builder(this.getContext(), this.adUnitId) | |
.forAppInstallAd(AdMobNativeAd.this) | |
.forContentAd(AdMobNativeAd.this) | |
.withNativeAdOptions(this.getNativeAdOptionsBuilder().build()) | |
.withAdListener(new AdListener() { | |
@Override | |
public void onAdOpened() { | |
AdMobNativeAd.this.notifyAdClicked(); | |
} | |
@Override | |
public void onAdFailedToLoad(final int errorCode) { | |
AdMobNativeAd.this.onAdFailedToLoad(errorCode); | |
} | |
}) | |
.build() | |
.loadAd(this.getAdRequestBuilder().build()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment