AppLovin / AppLovin-MAX-SDK-Android

Other
233 stars 104 forks source link

Migrating from MoPub + FAN mediation to MAX + FAN (Native) #185

Closed dirkam closed 2 years ago

dirkam commented 2 years ago

Can someone please help me how the FAN mediation works with MAX for Native Ads (Manual)? The AppLovin guide shows what to do on the dashboard, but I can't find the code that is needed to render the FAN native ad?

With MoPub, there was the FacebookAdRenderer used to render the native ad.

FacebookAdRenderer facebookAdRenderer = new FacebookAdRenderer(
    new FacebookAdRenderer.FacebookViewBinder.Builder(R.layout.native_ad_list_item)
        .titleId(R.id.native_title)
        .textId(R.id.native_text)
        .mediaViewId(R.id.native_main_image)
        .adIconViewId(R.id.native_icon_image)
        .adChoicesRelativeLayoutId(R.id.native_ad_choices_relative_layout)
        .advertiserNameId(R.id.native_title) // Bind either the titleId or advertiserNameId depending on the FB SDK version
        .callToActionId(R.id.native_cta)
        .build());

I can't find the equivalent of this in MAX. What do I miss here?

santoshbagadi commented 2 years ago

Hi @dirkam , you don't need a separate render/binder for each network with. MAX ads. You just need one binder for rendering ads from all networks.

dirkam commented 2 years ago

Thanks @santoshbagadi, that's nice to hear! May I ask how will it handle the layout differences? For FAN Native Ads for instance, the icon and the main asset uses com.facebook.ads.MediaView while MAX uses ImageView and FrameLayout. How does that work?

santoshbagadi commented 2 years ago

For media view, we would create the com.facebook.ads.MediaView ourselves and add it to the FrameLayout provided.

For the icon view, Facebook supports both its own media view and ImageView. So, we use the image view in this case.

dirkam commented 2 years ago

Thanks!