fbsamples / audience-network

Open source projects to demonstrate SDK and sample code usages and integration, and to collaborate and support peers in this community.
https://developers.facebook.com/docs/audience-network
Other
319 stars 370 forks source link

How to avoid the view type when the ad loading is failed ? #166

Closed Meet-Miyani closed 1 year ago

Meet-Miyani commented 1 year ago

If there's a condition when ads are not loading from the server At that time the size of the adsList will be 0 And the PostList Size let's take = 20 With AD_FREQUENCY = 4 So, after every 4 post an Ad will be displayed, and in getItemViewType method we have the modulas function (position%AD_FREQ..) So. by default it will return the AD_TYPE and the AD Will not be loaded, resulting in empty ad layout inflation. Moreover we will skip the Post Item by 4, As the size of adslist is 0 and updating the index for post items, so how to resolve this thing ? I tried checking the adItems size before getting viewType but it's not helping

https://github.com/fbsamples/audience-network/blob/main/samples/android/KotlinAdUnitsSample/src/main/java/com/facebook/samples/adunitssamplekotlin/adapters/NativeAdRecyclerAdapter.kt

github-actions[bot] commented 1 year ago

Dear developers. You will not be able to create new bug reports on GitHub after 28 April, and existing tickets will be automatically closed.

Instead, please use the bug report (https://developers.facebook.com/support/bugs/) tool to report a bug on Audience Network. Our engineers will get back to you as soon as possible.

If you have any other questions or suggestions relating to Facebook Audience Network, please use the online publisher support portal (https://www.facebook.com/business/publishersupport?hc_location=ufi) to submit a request.