Code Integration for Android

Get started with Prebid Mobile by creating a Prebid Server account.

Use Maven?

Easily include the Prebid Mobile SDK using Maven. Simply add this line to your gradle dependencies:

compile 'org.prebid:prebid-mobile-sdk:[0,1)'

Build framework from source

Build Prebid Mobile from source code. After cloning the repo, from the root directory run

./buildprebid.sh

to output the PrebidMobile framework for Android.

Integrate Ad Servers With Your App

Integrating MoPub with your application

  1. Go to MoPub.com and register for a MoPub account . If you already have an account with them, you can log in .
  2. After the registration you will be automatically prompted to set up a new MoPub application required for integrating mobile ads to your application.

Integrating Google with your application

Go to Google’s developer site and follow the instructions for integrating their Mobile Ads SDK into your app.

Set Targeting Parameters (Optional)

Targeting parameters enable you to define the target audience for the bid request. Prebid Mobile supports the following global targeting parameters. These targeting parameters are set only once and apply to all Prebid Mobile ad units. They do not change for a given user session.

View the full list of targeting parameters

Create Ad Units

Banner and interstitial ad units can be created:

BannerAdUnit bannerAdUnit = new BannerAdUnit("PREBID_SERVER_CONFIGURATION_ID", 300, 250);

For details on creating the specific ad units and additional parameters and methods associated with each view the documentation pertaining to them:

Banner Ad Unit
Interstitial Ad Unit

Add Custom Keywords

Once an ad unit has been instantiated, custom keywords can be added to it to improve its targeting.

bannerAdUnit.setUserKeyword("my_key", "my_value");

For more details on custom keywords, review the adUnit class documention

Further Reading