Installation of the Android SDK

1. Installation with Gradle

Tapdaq requires Android API 14 or higher, the following networks require higher minimum:

Network Minimum API Level
AppLovin 16
InMobi 15
MoPub 16
YouAppi 16

A. Add Tapdaq & ad networks

repositories {
  google()
  jcenter()

  //Tapdaq SDK & Adapters
  maven { url "http://android-sdk.tapdaq.com" }

  // AdColony
  maven { url  "https://adcolony.bintray.com/AdColony" }

  // HyprMX
  maven { url "https://raw.githubusercontent.com/HyprMXMobile/Android-SDKs/master" }

  // Ironsource
  maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }

  // Mopub
  maven { url "https://s3.amazonaws.com/moat-sdk-builds" }

  // TapJoy
  maven {
    name "Tapjoy's maven repo"
    url "https://tapjoy.bintray.com/maven"
  }

  // Vungle
  maven { url "https://jitpack.io" }

  // YouAppi
  maven { url "http://repository.youappi.com/repository/release" }

}

dependencies {
  //Tapdaq
  implementation 'com.tapdaq.sdk:Tapdaq-BaseSDK:'

  //Adapters - These will automatically pull ad network dependencies

  implementation 'com.tapdaq.sdk:TapdaqAdColonyAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqAdMobAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqAppLovinAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqChartboostAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqFANAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqHyprMXAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqInmobiAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqIronsourceAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqKiipAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqMoPubAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqReceptivAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqTapjoyAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqUnityAdsAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqVungleAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqYouAppiAdapter:'
  implementation 'com.tapdaq.sdk:TapdaqZPlayAdapter:'

}

B. Add Jars

The following networks require a .jar file to be added manually, download the required libraries and add them to your libs folder.

If you are using ProGuard in your app, see our Proguard page for details.

C. Network Specific Settings

Chartboost

Chartboost depends on play-services-base. If you're not already including it, add it to your dependencies like so:

implementation "com.google.android.gms:play-services base:16.0.0"

Facebook Audience Network

For Android P (9.0) devices, in order to load ads a config must be added to the AndroidManifest.xml, see full details on the Facebook website

2. Authenticate with Tapdaq

A. Override the TMInitListener

This listener object is provided in the initialise method, didInitialise will be called when the Tapdaq SDK is ready to receive requests such as load/show method calls. didFailToInitialise may be called if Tapdaq was unable to initialise.

public class TapdaqInitListener extends TMInitListener {

    public void didInitialise() {
        super.didInitialise();
        // Ads may now be requested
    }

    @Override
    public void didFailToInitialise(TMAdError error) {
        super.didFailToInitialise(error);
        //Tapdaq failed to initialise
    }
}

B. Initialise Tapdaq

Add the import statement in your main activity:

import com.tapdaq.sdk.*;
import com.tapdaq.sdk.common.*;
import com.tapdaq.sdk.listeners.*;

Navigate to the following method in your main activity, and add the following code:

You have no inactive Android apps on your account. You can add a new app here.


protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  TapdaqConfig config = new TapdaqConfig();
  config.setUserSubjectToGDPR(STATUS.TRUE); //GDPR declare if user is in EU
  config.setConsentGiven(true); //GDPR consent must be obtained from the user
  config.setIsAgeRestrictedUser(false); //Is user under 16 (Used by AppLovin & YouAppi)

  Tapdaq.getInstance().initialize(this, "<APP_ID>", "<CLIENT_KEY>", config, new TapdaqInitListener());
}

Once the Tapdaq SDK initialises, didInitialise() will be called.

3. Update GDPR Consent

Consent can be updated mid session as well as at initialisation, it can be set and unset.

Tapdaq.getInstance().setUserSubjectToGDPR(MainActivity.this, STATUS.TRUE);
Tapdaq.getInstance().setContentGiven(MainActivity.this, true);
Tapdaq.getInstance().setIsAgeRestrictedUser(MainActivity.this, true);

4. Lifecycle methods

Within each of your Activity classes, override onPause() and onResume, adding in a call to Tapdaq to pass these events to the adapters.

    @Override
    protected void onPause() {
        super.onPause();
        Tapdaq.getInstance().onPause(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        Tapdaq.getInstance().onResume(this);
    }

Note: This is only required for Receptiv

5. Display an advert

To display the advert, please click on one of the following guides.

You can test that each ad network has been integrated correctly by visiting the Debugging page.

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.