Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeking suggestion: To display banner ads at regular intervals in a feed list, which is an infinitely paginated flat list #116

Open
AppalaNaidu01 opened this issue Dec 5, 2023 · 1 comment

Comments

@AppalaNaidu01
Copy link

This is not a bug; I am seeking suggestions on how to integrate ads into a React Native project with the following requirements:

I have an infinitely scrollable flat list of feed items, similar to Instagram, where I need to display banner ads at regular intervals.
This involves handling scenarios such as:

  1. If an Ad request succeeds for a specific index - Display the Ad at the index
  2. If an Ad request fails for a specific index - Display the next feed item rather than displaying a Placeholder/Empty view
  3. If an Ad request fails because of timeout error - Display the next feed item
  4. If the index where an Ad should be displayed is scrolled before receiving a successful response for the ad request - Display the next feed item
    • But if the index where the Ad isn't displayed because of the delayed response should be displayed if the user scrolls up to that index again.

The approach I am thinking of at the moment:
I thought that the solution for the above use cases is to pre-fetch the banner ad view object before displaying it. But, because the Banner Ad is a component in this SDK, I should only be able to load the Ad(make an Ad request) after mounting the component into the screen or flat list. However, with this approach, I wasn't able to handle the failure cases.

But with the above approach, I need to find a way to pre-fetch the banner ad object.

Can you please help me by sharing any better approach you can think of? Or can you please help me with improving my approach to implement this?

@mark-okiki
Copy link

  1. Use the Android ViewHolder pattern to get the item viewtype and choose to render the list Item or ad.
  2. Calculate or set the NativeAd's height if the ad loads successfully
  3. Set the height of the NativeAd to 0 id the ad fails

I don't see how you can prefetch the ad

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

No branches or pull requests

2 participants