Getting Started with the Android SDK

Getting started with the Taboola Android SDK

🚧

Update your project to Artifactory

As of May 1st, 2021, all versions of the Taboola SDK will be available via Artifactory.

Please make sure to update your top-level build.gradle file accordingly (see below).

Step 1: Add the Taboola URL for Artifactory

In your top-level build.gradle file, add the Taboola URL for Artifactory under allprojects > repositories:

buildscript {
    repositories {
        ...
    }
    dependencies {
        ...
    }
}

allprojects {
    repositories {
        ...
        maven {
            // Taboola:
            url 'https://taboolapublic.jfrog.io/artifactory/mobile-release'
        }
    }
}

🚧

Checklist

Make sure to add the Taboola URL:

  • In your top-level build.gradle file.
  • Under allprojects > repositories.

Step 2: Add the library dependency to your project

Latest version: 2.8.4 (Released on April 28th, 2021) Changelog

In your app module build.gradle file, add the Taboola SDK dependencies:

//Include the Taboola SDK binary
implementation 'com.taboola:android-sdk:2.8.4'

//Taboola SDK requires the following dependency (mandatory)
implementation 'com.android.support:customtabs:28.0.0'

📘

Gradle plugin version

Please follow this link if you're getting an "Android resource linking failed" grade error while compiling your project

Step 3: For Publishers who use AndroidX

Taboola recommends using Android SDK 2.7.0 and above if you're using AndroidX in your project.

Please follow these two steps to make sure the SDK and your AndroidX works well:

  1. Taboola SDK requires to enable the "Jetifier". Please add the following lines to your gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
  1. In your app module build.gradle file, add the androidx.browser dependency, in place of com.android.support:customtabs.
dependencies {
   implementation "androidx.browser:browser:1.2.0"
   // If you're targeting API 29 or above, add this dependency as well:
   implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' 
}

//If you're using Java 1.7 - please use version 1.0.0 of the androidx.browser:browser dependency - 
// "androidx.browser:browser:1.0.0"

Step 4: Verify the AndroidManifest.xml

Include these lines in your app’s AndroidManifest.xml to allow Internet access and read the network state

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Step 5: Proguard rules

📘

Consumed Proguard Rules

Starting from Android SDK version 2.3.7, Taboola SDK will automatically add the Proguard rules to the project. If you wish to work manually, you can use the following rules.

Add the following Proguard rules (relevant for Android SDK version 2.3.3 (including) and above)

###---------- Begin: proguard configuration for Taboola Android SDK 2.3.3 and above  ----------
-dontwarn com.taboola.android.api.**
-keepnames class com.taboola.android.integration_verifier.testing.tests.proguard_stub.ProguardVerificationStub
-keep class com.taboola.android.TaboolaContextProvider { *; }
###---------- End: proguard configuration for Taboola Android SDK 2.3.3 and above  ------------

For the PG rule for Android SDK versions 2.1.1 until SDK version 2.3.0 (including) - click here

For the PG rules for Android SDK versions before 2.1.0 - click here

Step 6: Allowing HTTP traffic (optional)

Starting with Android 9.0 (API level 28), HTTP traffic (non-secured) is disabled by default. We recommend allowing HTTP traffic to support Taboola's advertisers who are not using secure landing pages.

If you can allow HTTP traffic, please add the android:usesCleartextTraffic="true" setting to your AndroidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
    </application>
</manifest>

How to update the SDK (optional)

We encourage developers to use the latest SDK version. To stay up-to-date, please check our announcements and change log. We highly recommend updating to the latest SDK version once a quarter.

How to upgrade?

When upgrading the SDK please update your build.gradle file with the latest version - replace the [LATEST_SDK_VERSION_HERE] with the latest version number

implementation 'com.taboola:android-sdk:[LATEST_SDK_VERSION_HERE]'

Special Instructions for upgrading from a specific Android SDK versions

Upgrading from SDK versionn

Special instructions

2.0.0 until 2.2.1 (including)

When using Widget via Native (SDK Standard), the SDK will update the widget height more than once

1.x.x

Any upgrade from SDK 1.x.x to SDK 2.x.x should be considered as a new integration. Please go over all of the steps outlined on this documentation

📘

SDK Size

  • Taboola SDK supports Android API 14 and above
  • The SDK size is 441.89 KB

Updated 7 days ago


Getting Started with the Android SDK


Getting started with the Taboola Android SDK

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.