Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Ads repeating on running the demo code. #11

Open
yashasvi128 opened this issue Nov 23, 2018 · 1 comment
Open

Ads repeating on running the demo code. #11

yashasvi128 opened this issue Nov 23, 2018 · 1 comment

Comments

@yashasvi128
Copy link

I ran this code and the native ads in the list are sometimes working fine but most of the time they are like the bottom two screenshots.
Can you please check whats wrong in this demo code?
Tried on different devices but no luck :(

I just changed the layout of the ad for the demonstration of the issue, so I could show that multiple ads are showing on same page together.

image
image

@ingvictoriano
Copy link

ingvictoriano commented Jan 16, 2019

I'm having the same issue. I've tracked it down to adLoader.isLoading()

According to documentation

public boolean isLoading ()
Returns true if the ad is loading. If multiple ads are requested, returns true until all ads finish loading.

But it appears that it sometimes returns true even if the 5 native ads aren't loaded. So on onUnifiedNativeAdLoaded the method insertAdsInMenuItems() is called multiple times.

Workaround is to change the if to

if (mNativeAds.size() == NUMBER_OF_ADS) {
     insertAdsInMenuItems();
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants