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
AdMob 16
AppLovin 16
Chartboost 21
InMobi 16
IronSource 16
Maio 16
UnityAds 19

Chartboost & InMobi require the project to use Java 8

A. Add Tapdaq & ad networks


  repositories {
    google()
    mavenCentral()
    jcenter()
  
    //Tapdaq SDK and Adapters
    maven { url "https://android-sdk.tapdaq.com" }
    
    //Ironsource
    maven { url "https://android-sdk.is.com/" }
    //Maio
    maven { url "https://imobile-maio.github.io/maven" }
    //Pangle
    maven { url "https://artifact.bytedance.com/repository/pangle" }
    //Tapjoy
    maven { url "https://sdk.tapjoy.com" }
  }
  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:TapdaqInmobiAdapter:'
    
    implementation 'com.tapdaq.sdk:TapdaqIronsourceAdapter:'
    
    implementation 'com.tapdaq.sdk:TapdaqMaioAdapter:'
    
    implementation 'com.tapdaq.sdk:TapdaqPangleAdapter:'
    
    implementation 'com.tapdaq.sdk:TapdaqTapjoyAdapter:'
    
    implementation 'com.tapdaq.sdk:TapdaqUnityAdsAdapter:'
    
    implementation 'com.tapdaq.sdk:TapdaqVungleAdapter:'
    
  }
  

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

B. Network Specific Settings

AdMob

Within the application element of the AndroidManifest.xml file add your Google AdMob Application ID from the AdMob dashboard, see documentation.

<application>
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx"/>
</application>

Facebook Audience Network

For Android P (9.0) or higher 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:

Log in with your Tapdaq account to have these keys generated automatically.


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

  TapdaqConfig config = Tapdaq.getInstance().config();
  
  config.setUserSubjectToGdprStatus(STATUS.TRUE); //GDPR declare if user is in EU
  config.setConsentStatus(STATUS.TRUE); //GDPR consent must be obtained from the user
  config.setAgeRestrictedUserStatus(STATUS.FALSE); //Is user subject to COPPA or GDPR age restrictions
     
  Tapdaq.getInstance().initialize(this, "<APP_ID>", "<CLIENT_KEY>", config, new TapdaqInitListener());
}
  

For more on GDPR and COPPA compliance, see the User Privacy section.

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().setConsentGiven(MainActivity.this, STATUS.FALSE);
Tapdaq.getInstance().setIsAgeRestrictedUser(MainActivity.this, STATUS.UNKNOWN);

4. 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.