How To Remove A Native Ad From The MoPubRecyclerAdapter on Android?

mopub

#1

Is there a way to remove a specific native ad item/cell from the MoPubRecyclerAdapter?

Expected

The ability to remove a specific cell from Twitter MoPub’s MoPubRecyclerAdapter containing a native ad.

Use case: In a feed of content where the RecyclerView cells are dismissible it is important to keep the dismiss action consistent for the MoPub native ad cells in order to match the rest of the content. In addition, not being able to dismiss the native ads will create a scenario where multiple ads will be next to each other in the feed creating a poor user experience as the rest of the content is dismissed.

Actual

The function to dismiss a specific ad’s cell of the MoPubRecyclerAdapter is not accessible by the public API.

The MoPubStreamAdPlacer object which is responsible for managing the ads in a given feed contains a removeItem and removeAdsInRange method which provides the required functionality. However, the MoPubStreamAdPlacer object is private accessible within the MoPubRecyclerAdapter and therefore can not be utilized.

Potential Solution

Building a CustomMoPubRecyclerAdapter that extends MoPubRecyclerAdapter and making MoPubStreamAdPlacer publicly accessible.


#2

@adamhurwitz

It looks like this was addressed through GitHub. Sharing the thread here for the larger group. Thanks again for bringing this to our attention!