AdLoader adLoader = new AdLoader.Builder(itemView.getContext(), unitId).forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
@Override
public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {
Log.e("test", "onAppInstallAdLoaded");
}
})
.forContentAd(new NativeContentAd.OnContentAdLoadedListener() {
@Override
public void onContentAdLoaded(NativeContentAd contentAd) {
Log.e("test", "onContentAdLoaded");
}
})
.withAdListener(new com.google.android.gms.ads.AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
Log.e("test", "onAdFailedToLoad errorCode=" + errorCode);
}
})
.withNativeAdOptions(new NativeAdOptions.Builder()
// Methods in the NativeAdOptions.Builder class can be
// used here to specify individual options settings.
.build()).build();
// Request an ad
adLoader.loadAd(new AdRequest.Builder().build());