The deltaDNA SmartAds SDK provides your Android game with access to our intelligent ad mediation platform. It supports both interstitial and rewarded type ads.


SmartAds Extension for Android

Contents

Adding to a project

The deltaDNA SmartAds SDK can be used in Android projects using minimum SDK version 15 and newer (Android 4.0.3+).

Gradle

In your top-level build script

In your app’s build script

Any combination of the above ad providers can be defined in your build script, depending on which ad networks you would like to use in your application.

Please note that the versions used for SmartAds and the providers should be the same. We cannot guarantee that an ad provider will work correctly if there is a version mismatch.

Usage

An instance can be retrieved by calling DDNASmartAds.instance() , and registering for ads can be done through the registerForAds(Activity)  method. The analytics SDK should be initialised and started before registering for ads.

SmartAds should be notified of when your Activity  is resumed, paused, and destroyed by overriding the lifecycle methods and calling the appropriate methods on DDNASmartAds .

Whether an ad is available can be checked by using isInterstitialAdAvailable()  for interstitial ads, and isRewardedAdAvailable()  for rewarded ads.

Ads can finally be shown by calling showInterstitialAd()  or showRewardedAd()  for rewarded ads.

In order to listen to the lifecycle of ads setAdsListener(AdsListener)  or setRewardedAdsListener(RewardedAdsListener)  can be used to set a listener.

Permissions

The library includes all the required permissions in its manifest file which will get included by Android’s manifest merger during the build process. The included permissions are the minimal required set for ensuring functionality of the ad providers, and all of them are non-dangerous permissions and thus don’t require explicit granting of permissions on Android 6+ versions.

Additional (often dangerous) permissions may be added to increase the functionality/performance for the ad network providers. These have been listed in every provider’s manifest file as a comment. You may add any of these to your application’s manifest as needed.

ProGuard

There is no need to add additional directives in your ProGuard configuration if you are setting minifyEnabled true  for your application as the library provides its own configuration file which gets included by the Android build tools during the build process.

FAQs

  1. My project has a dependency on a newer version of Google Play Services, can I use a different version than what SmartAds uses internally?Yes. If you have added any of the other Play Service modules to your dependencies then you can change the version to what you require, for example
    compile 'com.google.android.gms:play-services-maps:8.4.0'

    We have verified so far that versions 8.* can be used instead of version 7.8.

  2. I’m getting a TransformException  on the transformClassesWithDexForDebug  task when my project is being built.This can happen if you have included more ad providers which can result in your app containing more than 65K methods. Ad providers can either be removed to decrease the method count, or an official workaround can be implemented.

Changelog

Can be found here.

License

The sources are available under the Apache 2.0 license.