use of com.facebook.ads.AdView in project react-native-fbads by callstack.
the class BannerView method createAdViewIfCan.
private void createAdViewIfCan() {
if (myAdView == null && mPlacementId != null && mSize != null) {
myAdView = new AdView(this.getContext(), mPlacementId, mSize);
myAdView.setAdListener(this);
myAdView.loadAd();
}
}
use of com.facebook.ads.AdView in project mopub-android-mediation by mopub.
the class FacebookBanner method loadBanner.
/**
* CustomEventBanner implementation
*/
@Override
protected void loadBanner(final Context context, final CustomEventBannerListener customEventBannerListener, final Map<String, Object> localExtras, final Map<String, String> serverExtras) {
mBannerListener = customEventBannerListener;
final String placementId;
if (serverExtrasAreValid(serverExtras)) {
placementId = serverExtras.get(PLACEMENT_ID_KEY);
} else {
mBannerListener.onBannerFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
return;
}
int width;
int height;
if (localExtrasAreValid(localExtras)) {
width = (Integer) localExtras.get(DataKeys.AD_WIDTH);
height = (Integer) localExtras.get(DataKeys.AD_HEIGHT);
} else {
mBannerListener.onBannerFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
return;
}
AdSize adSize = calculateAdSize(width, height);
if (adSize == null) {
mBannerListener.onBannerFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
return;
}
AdSettings.setMediationService("MOPUB_" + MoPub.SDK_VERSION);
mFacebookBanner = new AdView(context, placementId, adSize);
mFacebookBanner.setAdListener(this);
mFacebookBanner.disableAutoRefresh();
mFacebookBanner.loadAd();
}