Installation of the Android SDK

Please download our latest SDK.

1. Installation with Gradle

A. Add Repositories

Update the repositories in your app's build.gradle file to enable the following 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" }
}

B. Add Dependencies

Update the dependencies in your APP-LEVEL build.gradle file to enable the following networks:

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

    //Adapters - These will automatically pull ad network dependencies
    implementation 'com.tapdaq.sdk:TapdaqAdColonyAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqAdMobAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqAppLovinAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqChartboostAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqFANAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqHyprMXAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqInmobiAdapter:6.4.0'

    //Ironsource dependency requires explicit reference
    implementation('com.tapdaq.sdk:TapdaqIronsourceAdapter:6.4.0') {
        transitive false
    }

    implementation 'com.ironsource.sdk:mediationsdk:[email protected]'

    implementation 'com.tapdaq.sdk:TapdaqKiipAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqMoPubAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqReceptivAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqTapjoyAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqUnityAdsAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqVungleAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqYouAppiAdapter:6.4.0'
    implementation 'com.tapdaq.sdk:TapdaqZPlayAdapter:6.4.0'
}

C. Add Jars

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

Note: If you are using ProGuard in your app, see our Advanced page for details.

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.ads.*;

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.