Native Integration Options

MoPub offers two major types of native ads placements on both iOS and Android. Native ads are typically shown in streams of content, aren’t limited to using HTML provided by the advertiser, and are shown and built using the same tools as your application.

iOS Integration Types

UITableView UICollectionView Custom Stream Manual AdPlacer
UITableView Example UICollectionView Example Custom Stream Example Manual AdPlacer Example

UITableView

MPTableViewAdPlacer is the recommended approach if your app uses a UITableView. Consider this before using a different type of integration.

UITableView Example

Features

  • Wraps table view datasource and delegate
  • Fewer than 10 lines of code to integrate
  • Control position of ads through MoPub UI
  • Smart insertion of ads into stream without empty cells
  • Pre-caching for smooth scrolling

View Sample Code on GitHub

UICollectionView

MPCollectionViewAdPlacer is the recommended approach if you have a UICollectionView. If you have a UICollectionView, consider this before using a different type of integration.

UICollectionView Example

Features

  • Wraps collection view datasource and delegate
  • Fewer than 10 lines of code to integrate
  • Control position of ads through MoPub UI
  • Smart insertion of ads into stream without empty cells
  • Pre-caching for smooth scrolling

Custom Stream

MPStreamAdPlacer is the recommended approach if you have a custom stream of a type that is not supported through MPTableViewAdPlacer or MPCollectionViewAdPlacer. It can be customized for any kind of stream-like integration, but takes more work to implement compared to the other integration types.

Custom Stream Example

Features

  • Knows how many items are in context
  • Control position of ads through MoPub UI
  • Smart insertion of ads into stream without empty cells
  • Pre-caching for smooth scrolling
  • Places ads based on the configuration provided in SDK about the visible range of items

Manual AdPlacer

For custom implementations where a native ad needs to be shown outside of the context of a stream, you should manually request native ads using the MPNativeAd and MPNativeAdRequest classes.

Manual AdPlacer Example

Features

  • Developer manually requests and receives
  • Developer has to handle caching
  • Developer has to handle not showing empty spaces in case the ad request doesn’t fill

Instructions for Manual Integration: iOS , Android

Android Integration Types

List or Recycler Adapter Custom Stream Ad View
List or Recycler Adapter Example Custom Stream Example Ad View Example

List/Recylcer Adapter

MoPubAdAdapter facilitates placing ads into an Android ListView or other widgets that use an Android Adapter.

List or Recycler Adapter Example

Features

  • Wraps adapter and will call it with original position of content
  • Control position of ads through MoPub UI
  • Smart insertion of ads into stream without empty cells
  • Pre-caching for smooth scrolling

Custom Stream

MoPubStreamAdPlacer facilitates loading ads and placing them into a content stream for situations where the ad adapter doesn’t work.

Custom Stream Example

Features

  • Doesn’t present or insert ads on its own
  • Developer has to provide a listener to handle ad insertions
  • Developer must call loadAds() to load ads

Manual AdPlacer

For custom implementations where a native ad needs to be shown outside of the context of a stream, you should manually integrate Native Ads with the MoPubNative class.

Ad View Example

Features

  • Developer manually requests and receives ad content
  • Developer has to handle caching
  • Developer has to handle not showing empty spaces in the case the ad request doesn’t fill

Last updated October 10, 2018

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2018 MoPub Inc.