googleads / googleads-mobile-android-mediation

Sample Android project showcasing how to build a mediation adapter or custom event for the Google Mobile Ads SDK.
Apache License 2.0
241 stars 197 forks source link

hasVideoContent() always returns false using UnifiedNativeAdMapper #496

Open Neexol opened 11 months ago

Neexol commented 11 months ago

Hello, If I use UnifiedNativeAdMapper when loading native ads and set the presence of video using setHasVideoContent() it has no effect.

Actual behavior: You can reproduce this bug in your example: 1) In the SampleUnifiedNativeAdMapper.java file, add setHasVideoContent(true) in the constructor; 2) In the MainActivity.java file, in the onNativeAdLoaded() callback, nativeAd.getMediaContent().hasVideoContent() and nativeAd.getMediaContent().getVideoController().hasVideoContent() will return false, although they should return true.

Expected behavior: hasVideoContent() returns true

Source: Here is the source code with my edits that reproduces the bug based on this repository example (too big for direct load).

I have set the use of custom event. Also call setHasVideoContent(true) at L70 in SampleUnifiedNativeAdMapper.java and check it at L235 in MainActivity.java.

image image
NVentimiglia commented 10 months ago

Hi @Neexol

Can you provide a minimal sample? I am having trouble understanding the issue.

I see SampleUnifiedNAtiveAdMapper.java, but there are multiple MainActivities

Neexol commented 10 months ago

Hello @NVentimiglia, I have attached the source code to the issue, here is the link again. You can laod a native ad and view info in Logcat. https://drive.google.com/file/d/1sia6eJC81yHZNVHI5jUcUU_9MlNXr5Vx/view

NVentimiglia commented 9 months ago

@Neexol

I replicated this on my end. Let me hand this off to the mediation team and I will get back to you.

NVentimiglia commented 9 months ago

@Neexol

Did some review, setHasVideoContent() does not override the MediaContent of the NativeAd. You can call setMediaContent() and include a MediaContent View Element to solve this problem.

That said, I will open an issue internally to get more information and possibly update this API.