Android integration documentation

Android Yieldlove SDK Integration Manual

1. Overview

To show a banner ad perform the following steps:

  1. Use Java 8 in your project

  2. Add SDK dependency to your project

  3. Add third-party dependencies to your project

  4. Set up application name

  5. Create a view element YieldloveAdView in your layout

  6. Request a Banner Ad Using an EventHandler

  7. Profit

these steps are described in more detail in the following paragraphs.

For interstitial ads the procedure is the same, perform steps 1 to 3 and then go to the Interstitial section described here

2. Before you start

Receive an APPLICATION_NAME (to be set only once) and a PUBLISHER_CALL_STRING (represents the slots). You will need to pass this id when requesting an ad using the SDK. Please contact your account manager at Ströer to get the APPLICATION_NAME and PUBLISHER_CALL_STRING. In case you would like to start testing as early as possible, but ad slots haven't been set up yet, we can provide you with test settings.

3. Try out our example app

We invite you to take a look at example app.

It already contains test configuration, so you can try it even before receiving APPLICATION_NAME and PUBLISHER_CALL_STRING.

Example app can also clarify some implementation details. It is also possible to change settings of the app and run it with your own configuration, after you receive it.

4. Use Java 8 in your project

Put this setting into your gradle file:

compileOptions { targetCompatibility = "8" }

5. Add SDK dependency to your project

Using Gradle:

Add our maven reference into your project setup (in buildscript and allprojects):

... buildscript { repositories { jcenter() google() maven { url 'https://slabs-yieldlove-ad-integration.s3.eu-central-1.amazonaws.com/android' } } } ...

The following block is useful for existing projects that already have been initialized and had this setting in build.gradle:

... allprojects { repositories { jcenter() google() maven { url 'https://slabs-yieldlove-ad-integration.s3.eu-central-1.amazonaws.com/android' } } } ...

The following block is useful for newly set up projects that have repositories specified in settings.gradle:

Use our libraries as dependencies:

For other package management tools, see page on Bintray

6. Add third-party dependencies to your project

Add Google repository (in buildscript and allprojects):

7. Set up application name

Before requesting an ad, you need to set up the APPLICATION_NAME property. This needs to be done only once. For example, in main application constructor.

8. Request a banner ad

8.1. Create a view element YieldloveAdView in your layout

Add YieldloveAdView to the layout where you would like to show a banner ad with an id. For example, AdContainer.

8.2. Using an EventHandler

Replace PUBLISHER_CALL_STRING and APPLICATION_NAME placeholders. Banner sizes and key-value targeting will be fetched from an external source.

9. Banner destroy

Destroy banner, when leaving the page which contains the ad slot, or if you need to hide an ad. It could make ad loading slow, especially if you have multiple slots on a page.

9.1. Is loading in progress?

If you know, that you will call the same slot name in the near future, you can check, if banner loading is in progress. Just wait until the banner is loaded instead of killing it and loading it again.

10. Request an Interstitial

Use the following code to show an interstitial. Replace PUBLISHER_CALL_STRING and APPLICATION_NAME placeholders. Key-value targeting will be fetched from an external source.

10.1 Interstitial Example Using an EventHandler

10.1.1 Set the FullScreenContentCallback

If you like to use FullScreenContentCallback (described in google library)

You can do it in onAdLoaded callback:

11. Rewarded (Interstitial) Ad

Use the following code to show an rewarded ad. Replace PUBLISHER_CALL_STRING and APPLICATION_NAME placeholders. Key-value targeting will be fetched from an external source.

11.1 Rewarded Ad Example Using an EventHandler

12. Quick start, testing configuration

Following the instructions given in the paragraphs above a developer can use this testing configuration to start early implementation.

  • App name is: appDfpTest

  • To request a Banner the ad slot is: banner

  • To request a Large Banner the ad slot is: banner?large

  • To request an interstitial the ad slot is: interstitial

13. Using Own Builder For DFP Requests

Properties for requests can be set on two levels (global - shared for all requests, and local - adSlot/adView specified)

13.1. Global - shared for all requests

That means that, e.g. when a key-value pair is set, it is set for all ad requests. Set the custom targeting as early as possible in your apps life-cycle to make sure every request contains the key-value pair.

NOTE: The methods .addCustomEventExtrasBundle() and .addNetworkExtrasBundle() are ignored on global level.

13.2. Local - adSlot/adView specified

Local request setting can be specified in AdListener. Local setting has priority over the global one, so if you have local and global settings, the local will be used. With this method it's possible to set properties per ad request.

14. Get ad sizes for specific adSlot from external config

Method for getting adSizes is available on YieldloveBannerAd object. This method can return null, if SLOT_NAME does not exist in configuration.

15. Prebid Global Targeting Parameters

The SDK integrates Prebid Mobile for header bidding. Prebid Mobile supports global targeting parameters. See the list of parameters on Prebid Mobile website. . Targeting parameters are set once and apply to all Prebid ad requests. They do not change during a given user session.

Because Prebid Mobile’s targeting is a global object, you can use it to set the targeting parameters directly. For example, set context keywords like this:

Prebid targeting

Note: As part of the initial integration, we already set the bundleID and storeURL for your app. So both fields do not need to be transferred additionally by you. However, please make sure to inform us in case of changes.

We strongly recommend to set contextual targeting parameters. Especially in cases where the user has not given consent in the CMP, we see better monetization if, for example, the Content URL is available in the ad request.

16. Clear configuration cache

The library is keeping some extended configuration based on application name. This configuration is updated according to defined interval. Here is a method to clear configuration cache. After clearing it will download new configuration immediately.

17. Banner Ad Auto-Refresh

This feature enables banner ad auto-refreshing after e.g. every 30 seconds. If you want to use this feature in your app, please contact your publisher account manager.

18. Debug Info Panel

Hold three fingers on an ad for three to four seconds until a notification pops up that SDK has entered ad debugging mode. In ad debugging mode SDK displays a debug info label in top left corner of a banner. Tap a label to bring up a panel with debugging information about an ad. Double tap the panel anywhere to copy the displayed text. Force close and re-open the app to exit ad debugging mode.

Alternatively, programmatically set Yieldlove.developerModeEnabled to true. This flag is meant for ad debugging purposes. Do not set this flag by default in builds which you intend to submit for distribution.

Change log

v6.17.1(5.10.2023)

Maintenance release, provide GAM Ad Unit in bid request.

v6.17.0 (9.8.2023)

Introduce debug info panel. Please use

instead of a simple

to add a banner to a view. This will enable hidden debug info functionality that Ströer’s TPM team will use when debugging ads in your production app.

v6.16.5 (5.4.2023)

  • fix a bug where propertyId present in override section of CMP configuration would be ignored

v6.16.4 (3.4.2023)

  • fix a bug where external config would not be correctly parsed

v6.16.3 (6.1.2023)

  • maintenance release, fix our error with release configuration

v6.16.2 (5.1.2023)

  • fixed Google SDK v21.3.0

v6.16.1 (21.11.2022)

  • fix dependency problem

v6.16.0 (14.10.2022)

  • integrates option to display rewarded ad

v6.15.4 (6.10.2022)

  • allows version of Criteo SDK to v4.8.1 or newer

v6.15.3 (4.10.2022)

  • set fixed version of Criteo SDK to v4.7.0 (v4.8.0 has a bug)

v6.15.2 (26.09.2022)

  • fix consumer proguard

v6.15.1 (20.09.2022)

  • fix slot parser

v6.15.0 (07.09.2022)

  • improve automatic banner refresh feature

v6.14.1 (25.08.2022)

  • update dependency PrebidMobile to v2.0.3

v6.14.0 (12.08.2022)

  • enable adex feature with gdpr consent check

v6.13.0 (11.08.2022)

  • enable monitoring feature

v6.12.3 (04.08.2022)

  • fix to prevent some crashes during the loading ad

v6.12.2 (25.07.2022)

  • fix getActiveNetworkInfo null problem

v6.12.1 (22.07.2022)

  • fix event session monitoring during the ad autorefreshing

v6.12.0 (20.07.2022)

  • add auto-refresh functionality for banner ads

v6.11.3 (20.07.2022)

  • another banner autorefresh bug fix

v6.11.2 (18.07.2022)

  • banner autorefresh bug fix

v6.11.1 (15.07.2022)

  • internal criteo adapter refactoring

v6.11.0 (08.07.2022)

  • add method to manually clear configuration cache if needed

v6.10.1 (07.07.2022)

  • refactor parsing of configuration

v6.10.0 (30.06.2022)

  • add automatic refresh feature for Prebid and Google

v6.9.0 (21.06.2022)

  • upgrade to GAM SDK v21 (which no longer support location api)

v6.8.1 (20.06.2022)

  • fix Prebid OM setup

v6.8.0 (06.06.2022)

  • added Partner name/version for OM

  • hide/show debug logs optionally

  • fix missing OM dependency for Prebid

  • internal refactoring

v6.7.0 (12.05.2022)

  • Prebid v2 integrated

v6.6.0 (04.05.2022)

  • monitoring (disabled)

  • the adex refactoring

  • consent refactoring

v6.5.2 (01.04.2022)

  • set min version GAM SDK to v20.6.0

  • add permission for getting advertiser ID

v6.5.1 (07.03.2022)

  • new internal consent resolver

v6.4.1 (08.02.2022)

  • fix logged null pointer exception

v6.4.0 (04.02.2022)

  • added support for propertyName overrides in Sourcepoint configurations

v6.3.0 (27.01.2022)

  • SDK now sends MRAID_1, 2 and 3 signals to Prebid server when configured in External Configuration.

v6.2.1 (24.01.2022)

  • added Criteo SDK

v6.1.0 (14.01.2022)

  • added custom headers in prebid request

v6.0.1 (4.11.2021)

  • code refactoring

  • fix: ext. config is currently fetched just once

v6.0.0 (25.10.2021)

  • add sending of content url into Prebid

v5.9.0 (8.10.2021)

  • getCmpConfig added

v5.8.1 (10.09.2021)

  • do not report error, that google play service is not available

v5.8.0 (05.08.2021)

  • SDK version info was added into prebid request

v5.7.0 (16.07.2021)

  • bundleId (or bundleName) can be set in external config

v5.6.1 (09.07.2021)

  • respect limited ad tracking

v5.6.0 (02.07.2021)

  • storeUrl can be set in external config

v5.5.1

  • change a way how to read a vendor adex permission, from consent string to vendors binary string

  • fix for api older than 26

v5.5.0

  • dependencies don't have fix versions

v5.4.3

  • Quickfix for Adex requests. Feature is off for Android SDK 25 and older

v5.4.2

  • ifa type in adex request was changed

v5.4.1

! fix reference problem

v5.4.0

  • sending contentUrl to Adex

v5.3.0

  • GAM SDK v20 is used

v5.2.2

  • fix to respect adslot name with underscores, not trying to split if non sdi structure

v5.2.1

  • SDK version was added into crash reporter

v5.2.0

  • inventory structure setup flexibility added: it adds logic distinguishing between two ways how to build dfp ad unit id according to app config setting

v5.1.0

  • uncaught errors from listener methods are forwarded to publisher code and not reported to alert system

v5.0.1

  • fix error when message in log is empty

v5.0.0

  • preparation for GAM v20

  • major changes:

    • YieldloveBannerAdListener interface

      • Removed methods: onAdLeftApplication, onAdInit

      • Added methods: onAdClicked, onAdImpression

      • Changes: return type of onAdRequestBuild method (PublisherAdRequest.Builder -> AdManagerAdRequest.Builder)

    • YieldloveInterstitialAdListener interface

      • Removed methods: onAdOpened, onAdClosed, onAdLeftApplication, onAdInit

      • Changes: return type of onAdRequestBuild method (PublisherAdRequest.Builder -> AdManagerAdRequest.Builder)

    • Yieldlove class

      • property changed: PublisherAdRequest.Builder publisherAdRequestBuilder -> AdManagerAdRequest.Builder adManagerAdRequestBuilder