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.4.5' 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:
- Add the Adjust Extension to your Adobe Experience app.
- Set your logging level to verbose to retrieve as much detail as possible from the extension.
- Test the Extension in sandbox mode to ensure it sends data to Adjust.
- Enable your app to open deep links.
- 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.
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 the operation 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 the
AppCompatActivitydocumentation for reference. com.adjust.sdk.Adjust-
Used to access Adjust APIs.
com.adjust.sdk.AdjustDeeplink-
Used to create Adjust deep links.
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:
- Create a new class that extends
Applicationin yourMainApp.javafile.
public class MainApp extends Application {}-
Open your
AndroidManifest.xmland find the<application>element. -
Add the name of your new class as an
android:nameattribute. In this example, the newApplicationclass is namedMainApp.<application android:name=".MainApp"></application> -
Within your
Applicationclass, find or add theonCreatemethod.
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:
- Inside your
onCreatefunction, callMobileCore.setApplication(this)to register the application context.
public void onCreate() { super.onCreate();
MobileCore.setApplication(this);}- Set your logging level by calling the
MobileCore.setLogLevelmethod 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.
public void onCreate() { super.onCreate();
MobileCore.setApplication(this); MobileCore.setLogLevel(LoggingMode.VERBOSE);}- Create a new
try...catchblock to configure the Adjust Extension:
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()); }}- Within your
tryblock, callMobileCore.configureWithAppIDand pass your Adobe app ID.
try { MobileCore.configureWithAppID("your_adobe_app_id");} catch (Exception e) { Log.e("example", "Exception occurred during configuration: " + e.getMessage());}- Within your
tryblock, create a new instance ofAdjustAdobeExtensionConfigwith the following argument:
environment:String- The environment in which your device is running.
- Pass
AdjustAdobeExtensionConfig.ENVIRONMENT_SANDBOXwhen testing. - Pass
AdjustAdobeExtensionConfig.ENVIRONMENT_PRODUCTIONwhen running the app in production.
- Pass
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());}- Call
AdjustAdobeExtension.setConfigurationwith yourAdjustAdobeExtensionConfiginstance as an argument.
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:
- Create a new
try...catchblock below your configuration block.
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()); } }}- Within your
tryblock, create a new list of the extensions you want to register. The example in this guide imports theAnalyticsandIdentityextensions in addition to theAdjustAdobeExtension.
extensions:List<Class<? extends Extension>>- Your list of extensions.
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());}- Inside your
tryblock, call theMobileCore.registerExtensionsmethod with your list of extensions and the following callback argument:
completionCallback:AdobeCallback- A callback function that fires when registration completes.
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.
- Create a new public class called
MainActivity. This class should extend theAppCompatActivityclass.
public class MainActivity extends AppCompatActivity {}- Create a new protected override function called
onCreate. This function receives thesavedInstanceStateand returnsvoid.
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) {}}- Within your
onCreatefunction, callsuper.onCreatewith thesavedInstanceStateto create your activity.
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);}- Next, call
setContentViewto map your activity to your app layout. In this example, the layout file is calledactivity_main.xml.
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);}Set up deep link handling
To configure the Adjust Android Extension for Adobe Experience SDK to open deep links, follow these steps:
- Create a new
Intentvariable calledintentinside youronCreatefunction and assign it the output ofgetIntent().
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
Intent intent = getIntent();}- Create a new
Urivariable calleddataand assign it the output ofintent.getData().
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
Intent intent = getIntent(); Uri data = intent.getData();}- Construct a new
AdjustDeeplinkinstance with yourdatavariable.
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
Intent intent = getIntent(); Uri data = intent.getData(); AdjustDeeplink adjustDeeplink = new AdjustDeeplink(data);}- To open the URL, pass your
AdjustDeeplinkinstance andgetApplicationContext()to theAdjust.processDeeplinkmethod.
@Overrideprotected 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.
@Overrideprotected 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.