adjust-icon

Integration guide

This is a step-by-step guide to help you integrate and configure the Adjust Extension in your Adobe Experience app for Android. With this extension, you can seamlessly integrate Adjust with the Adobe Experience SDK to capture and send attribution data and in-app event information.

This extension enables you to send installs, sessions, custom in-app events, and other types of data to Adjust. Follow this guide to set up and configure the Adjust Extension and verify that you can send install information to Adjust.

Set up your project

Follow these steps to set up your project to support the Adjust Extension for Adobe Experience SDK.

Install the Adjust Extension

To use the Adjust Extension for Adobe Experience SDK, you need to add it to your project as a dependency. The relevant packages are available on Maven.

Add the following to your build.gradle file:

com.adjust.adobeextension:adobeextension

The Adjust extension for Adobe Experience.

com.adjust.sdk:adjust-android

The Adjust Android SDK.

com.android.installreferrer:installreferrer

The Android Install Referrer API.

dependencies {
implementation 'com.adjust.adobeextension:adobeextension:3.0.0'
implementation 'com.adjust.sdk:adjust-android:5.0.2'
implementation 'com.adobe.marketing.mobile:core:3.2.0'
implementation 'com.android.installreferrer:installreferrer:2.2'
}

Add Google Play Services

Apps that target the Google Play Store must use the gps_adid (Google Advertising ID) to identify devices. To access the gps_adid, add the play-services-ads-identifier AAR to your project.

If you're using Maven, add the com.google.android.gms:play-services-ads-identifier implementation to your build.gradle file.

dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
}

Configure permissions

The Adjust Extension for Adobe Experience SDK bundles all required permissions by default. You don't need to add any permissions for the extension to work.

If your app needs to be COPPA (Children's Online Privacy Protection Act) compliant or you don't target the Google Play Store, you MUST remove the com.google.android.gms.permission.AD_ID permission using a remove directive in your AndroidManifest.xml file.

<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>

Integration guide

Once you've completed the project setup steps, you can integrate the Adjust SDK. The following guide shows you how to:

  1. Add the Adjust Extension to your Adobe Experience app.
  2. Set your logging level to verbose to retrieve as much detail as possible from the extension.
  3. Test the Extension in sandbox mode to ensure it sends data to Adjust.
  4. Enable your app to open deep links.
  5. Register with the Adobe Experience SDK.

To do this, you need to create two files:

  • MainApp.java: you'll configure and register the Adjust SDK in this file.
  • MainActivity.java: you'll configure deep link handling in this file.

Import classes

First, you need to import some classes into your application files. Import the following classes into your MainApp.java file:

android.app.Application

Used to create the main application.

android.util.Log

Used to output logs.

com.adjust.adobeextension.AdjustAdobeExtension

Used to register the Adjust Extension.

com.adjust.adobeextension.AdjustAdobeExtensionConfig

Used to configure the Adjust Extension.

com.adobe.marketing.mobile.AdobeCallback

Used when registering your extensions.

com.adobe.marketing.mobile.Extension

Used to build a list of extensions.

com.adobe.marketing.mobile.Analytics

Used to enable analytics in the Adobe Experience SDK.

com.adobe.marketing.mobile.Identity

Used to manage user identities in the Adobe Experience SDK

com.adobe.marketing.mobile.LoggingMode

Used to configure logging in the Adobe Experience SDK.

com.adobe.marketing.mobile.MobileCore

Used to communicate with the Adobe Experience SDK.

MainApp.java
import android.app.Application;
import android.util.Log;
import com.adjust.adobeextension.AdjustAdobeExtension;
import com.adjust.adobeextension.AdjustAdobeExtensionConfig;
import com.adobe.marketing.mobile.AdobeCallback;
import com.adobe.marketing.mobile.Extension;
import com.adobe.marketing.mobile.Analytics;
import com.adobe.marketing.mobile.Identity;
import com.adobe.marketing.mobile.LoggingMode;
import com.adobe.marketing.mobile.MobileCore;

Import the following classes into your MainActivity.java file:

android.content.Intent

Used to get theoperation intent from Android.

android.net.Uri

Used to type deep links.

android.os.Bundle

Used to type the app's saved instance state.

android.view.View

Used to type your app's view.

androidx.appcompat.app.AppCompatActivity

Used to create your main activity. See theAppCompatActivity documentationfor reference.

com.adjust.sdk.Adjust

Used to access Adjust APIs.

com.adjust.sdk.AdjustDeeplink

Used to create Adjust deep links.

MainActivity.java
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustDeeplink;

Create a global application class

The recommended way to register the Adjust Android Extension for Adobe Experience SDK is to use a global Android Application class. If you've not yet created an Application, follow these steps:

  1. Create a new class that extends Application in your MainApp.java file.

    MainApp.java
    public class MainApp extends Application {}
  2. Open your AndroidManifest.xml and find the <application> element.

  3. Add the name of your new class as an android:name attribute. In this example, the new Application class is named MainApp.

    <application android:name=".MainApp">
    </application>
  4. Within your Application class, find or add the onCreate method.

    MainApp.java
    public class MainApp extends Application {
    @Override
    public void onCreate() {
    super.onCreate();
    }
    }

Configure the Adjust Extension

Once you've created the Application class and called onCreate, follow these steps to configure the Adjust Android Extension for Adobe Experience SDK:

  1. Inside your onCreate function, call MobileCore.setApplication(this) to register the application context.

    MainApp.java
    public void onCreate() {
    super.onCreate();
    MobileCore.setApplication(this);
    }
  2. Set your logging level by calling the MobileCore.setLogLevel method with the following argument:

    logLevel: String

    The level of logging you want to enable.

    • LoggingMode.VERBOSE: enable all logging.
    • LoggingMode.DEBUG: disable verbose logging.
    • LoggingMode.WARNING: log only errors and warnings.
    • LoggingMode.ERROR: log only errors.
    MainApp.java
    public void onCreate() {
    super.onCreate();
    MobileCore.setApplication(this);
    MobileCore.setLogLevel(LoggingMode.VERBOSE);
    }
  3. Create a new try...catch block to configure the Adjust Extension:

    MainApp.java
    public void onCreate() {
    super.onCreate();
    MobileCore.setApplication(this);
    MobileCore.setLogLevel(LoggingMode.VERBOSE);
    try {
    } catch (Exception e) {
    Log.e("example", "Exception occurred during configuration: " + e.getMessage());
    }
    }
  4. Within your try block, call MobileCore.configureWithAppID and pass your Adobe app ID.

    MainApp.java
    try {
    MobileCore.configureWithAppID("your_adobe_app_id");
    } catch (Exception e) {
    Log.e("example", "Exception occurred during configuration: " + e.getMessage());
    }
  5. Within your try block, create a new instance of AdjustAdobeExtensionConfig with the following argument:

    environment: String

    The environment in which your device is running.

    • Pass AdjustAdobeExtensionConfig.ENVIRONMENT_SANDBOX when testing.
    • Pass AdjustAdobeExtensionConfig.ENVIRONMENT_PRODUCTION when running the app in production.
    MainApp.java
    try {
    MobileCore.configureWithAppID("your_adobe_app_id");
    AdjustAdobeExtensionConfig config =
    new AdjustAdobeExtensionConfig(AdjustAdobeExtensionConfig.ENVIRONMENT_SANDBOX);
    } catch (Exception e) {
    Log.e("example", "Exception occurred during configuration: " + e.getMessage());
    }
  6. Call AdjustAdobeExtension.setConfiguration with your AdjustAdobeExtensionConfig instance as an argument.

    MainApp.java
    try {
    MobileCore.configureWithAppID("your_adobe_app_id");
    AdjustAdobeExtensionConfig config =
    new AdjustAdobeExtensionConfig(AdjustAdobeExtensionConfig.ENVIRONMENT_SANDBOX);
    AdjustAdobeExtension.setConfiguration(config);
    } catch (Exception e) {
    Log.e("example", "Exception occurred during configuration: " + e.getMessage());
    }

Register the Adjust Extension

Once you've configured the Adjust Extension, you need to register it with the Adobe Experience SDK. To do this:

  1. Create a new try...catch block below your configuration block.

    MainApp.java
    public class MainApp extends Application {
    @Override
    public void onCreate() {
    super.onCreate();
    MobileCore.setApplication(this);
    MobileCore.setLogLevel(LoggingMode.VERBOSE);
    try {
    MobileCore.configureWithAppID("your_adobe_app_id");
    AdjustAdobeExtensionConfig config =
    new AdjustAdobeExtensionConfig(AdjustAdobeExtensionConfig.ENVIRONMENT_SANDBOX);
    AdjustAdobeExtension.setConfiguration(config);
    } catch (Exception e) {
    Log.e("example", "Exception occurred during configuration: " + e.getMessage());
    }
    try {
    } catch (Exception e) {
    Log.e("example", "Exception occurred while registering Extension: " + e.getMessage());
    }
    }
    }
  2. Within your try block, create a new list of the extensions you want to register. The example in this guide imports the Analytics and Identity extensions in addition to the AdjustAdobeExtension.

    extensions: List<Class<? extends Extension>>

    Your list of extensions.

    MainApp.java
    try {
    List<Class<? extends Extension>> extensions = Arrays.asList(
    Analytics.EXTENSION,
    Identity.EXTENSION,
    AdjustAdobeExtension.EXTENSION);
    } catch (Exception e) {
    Log.e("example", "Exception occurred while registering Extension: " + e.getMessage());
    }
  3. Inside your try block, call the MobileCore.registerExtensions method with your list of extensions and the following callback argument:

    completionCallback: AdobeCallback

    A callback function that fires when registration completes.

    MainApp.java
    try {
    List<Class<? extends Extension>> extensions = Arrays.asList(
    Analytics.EXTENSION,
    Identity.EXTENSION,
    AdjustAdobeExtension.EXTENSION);
    MobileCore.registerExtensions(extensions, new AdobeCallback<Object>() {
    @Override
    public void call(Object o) {
    Log.d("example", "Adjust Adobe Extension SDK initialized");
    }
    });
    } catch (Exception e) {
    Log.e("example", "Exception occurred while registering Extension: " + e.getMessage());
    }

Set up your activity file

Next, you need to set up your MainActivity.java file. You'll use this file to set up your Adjust features later. For the purposes of this guide, you're only going to set up the onCreate function to handle application startup.

  1. Create a new public class called MainActivity. This class should extend the AppCompatActivity class.

    MainActivity.java
    public class MainActivity extends AppCompatActivity {}
  2. Create a new protected override function called onCreate. This function receives the savedInstanceState and returns void.

    MainActivity.java
    public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {}
    }
  3. Within your onCreate function, call super.onCreate with the savedInstanceState to create your activity.

    MainActivity.java
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    }
  4. Next, call setContentView to map your activity to your app layout. In this example, the layout file is called activity_main.xml.

    MainActivity.java
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    }

To configure the Adjust Android Extension for Adobe Experience SDK to open deep links, follow these steps:

  1. Create a new Intent variable called intent inside your onCreate function and assign it the output of getIntent().

    MainActivity.java
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent intent = getIntent();
    }
  2. Create a new Uri variable called data and assign it the output of intent.getData().

    MainActivity.java
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent intent = getIntent();
    Uri data = intent.getData();
    }
  3. Construct a new AdjustDeeplink instance with your data variable.

    MainActivity.java
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent intent = getIntent();
    Uri data = intent.getData();
    AdjustDeeplink adjustDeeplink = new AdjustDeeplink(data);
    }
  4. To open the URL, pass your AdjustDeeplink instance and getApplicationContext() to the Adjust.processDeeplink method.

    MainActivity.java
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent intent = getIntent();
    Uri data = intent.getData();
    AdjustDeeplink adjustDeeplink = new AdjustDeeplink(data);
    Adjust.processDeeplink(adjustDeeplink, getApplicationContext());
    }

    If you use short branded links, you can alternatively use the Adjust.processAndResolveDeeplink method to resolve your shortened link and return it to a callback function.

    MainActivity.java
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent intent = getIntent();
    Uri data = intent.getData();
    AdjustDeeplink adjustDeeplink = new AdjustDeeplink(data);
    Adjust.processAndResolveDeeplink(adjustDeeplink, getApplicationContext(), new OnDeeplinkResolvedListener() {
    @Override
    public void onDeeplinkResolved(String s) {
    Log.d("example", "Unwrapped short link: " + s);
    }
    });
    }

Once you've completed these steps, build and run your app. In your log viewer, set the filter tag:Adjust to show only logs relating to the Adjust Extension. After you launch your app, you should see the message Install tracked.