Skip to content

Instantly share code, notes, and snippets.

@ShaishavGandhi
Last active May 29, 2018 04:00
Show Gist options
  • Save ShaishavGandhi/b8665312da68e27617ae4c28c46ca6ac to your computer and use it in GitHub Desktop.
Save ShaishavGandhi/b8665312da68e27617ae4c28c46ca6ac to your computer and use it in GitHub Desktop.
Existing Native Content Ad API
AdLoader adLoader = new AdLoader.Builder(context, "ca-app-pub-3940256099942544/2247696110")
.forContentAd(new OnContentAdLoadedListener() {
@Override
public void onContentAdLoaded(NativeContentAd contentAd) {
// Show the content ad.
}
})
.withAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
// Handle the failure by logging, altering the UI, and so on.
}
})
.withNativeAdOptions(new NativeAdOptions.Builder()
// Methods in the NativeAdOptions.Builder class can be
// used here to specify individual options settings.
.build())
.build();
adLoader.loadAd(new PublisherAdRequest.Builder().build());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment