adjust-icon

Integration guide

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

Follow this guide to set up and configure the SDK to send installs, sessions, custom in-app events, and other types of data 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

Add the Adjust SDK extension to your app's descriptor file:

<extensions>
<!-- ... -->
<extensionID>com.adjust.sdk</extensionID>
<!-- ... -->
</extensions>

Initialize the SDK

To initialize the Adobe AIR SDK v5, add the following code sample to your main Sprite:

package {
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.AdjustEnvironment;
import com.adjust.sdk.AdjustLogLevel;
public class Example extends Sprite {
public function Example() {
var appToken:String = "{YourAppToken}";
var environment:String = AdjustEnvironment.SANDBOX;
var adjustConfig:AdjustConfig = new AdjustConfig(appToken, environment);
adjustConfig.setLogLevel(AdjustLogLevel.VERBOSE);
Adjust.initSdk(adjustConfig);
}
}
}

Configure permissions

The Adjust SDK bundles all required permissions by default. You don't need to add any permissions for it to work.

COPPA (Children's Online Privacy Protection Act) compliance

com.google.android.gms.permission.AD_ID is bundled in the Adjust SDK for Android. You can remove it with the following snippet:

YOURAPP-app.xml
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
</manifest>
]]>
</manifestAdditions>
</android>

Check the Apps for children guide for more information about COPPA compliance.

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, you need to integrate the Google Play Services.

  1. Add the Google Play Services extension to your app's descriptor file:

    <extensions>
    <!-- ... -->
    <extensionID>com.adjust.gps</extensionID>
    <!-- ... -->
    </extensions>
  2. Add the following lines inside the <manifest> tag body of your app's Android manifest file:

    <meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version"/>

Set up Google Play Install Referrer API

The install referrer is a unique identifier which you can use to attribute an app install to a source. The Adjust SDK requires this information to perform attribution.

To support the Google Play Install Referrer API, follow these steps:

  1. Add the ANE extension to your app's XML descriptor file:

    <extensions>
    <!-- ... -->
    <extensionID>com.adjust.installref</extensionID>
    <!-- ... -->
    </extensions>
  2. Add Android permission to allow the install referrer ANE to fetch install referrer data:

    <android>
    <manifestAdditions>
    <![CDATA[
    <manifest>
    <uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
    <application>
    <! -- ... -- >
    </application>
    </manifest>
    ]]>
    </manifestAdditions>
    </android>

Integration guide

TODO: Adapt the tutorial to Adobe AIR

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 Adobe AIR app.
  2. Set your logging level to verbose to retrieve as much detail as possible from the extension.
  3. Test the SDK 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:

  • Main.as: you'll configure and register the Adjust SDK in this file.
  • Main-app.xml: your app's descriptor file.

Import classes

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

com.adjust.sdk.Adjust;

Used to

com.adjust.sdk.AdjustConfig;

Used to

com.adjust.sdk.AdjustEvent;

Used to

com.adjust.sdk.AdjustEventSuccess;

Used to

com.adjust.sdk.AdjustEventFailure;

Used to

com.adjust.sdk.AdjustSessionSuccess;

Used to

com.adjust.sdk.AdjustSessionFailure;

Used to

com.adjust.sdk.AdjustAttribution;

Used to

com.adjust.sdk.Environment;

Used to

import com.adjust.sdk.LogLevel;

Used to

import com.adjust.sdk.UrlStrategy;

Used to

Main.as
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.AdjustEvent;
import com.adjust.sdk.AdjustEventSuccess;
import com.adjust.sdk.AdjustEventFailure;
import com.adjust.sdk.AdjustSessionSuccess;
import com.adjust.sdk.AdjustSessionFailure;
import com.adjust.sdk.AdjustAttribution;
import com.adjust.sdk.Environment;
import com.adjust.sdk.LogLevel;
import com.adjust.sdk.UrlStrategy;

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 Main.as file.

    Main.as
    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.

    Main.as
    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.

    Main.as
    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.
    Main.as
    public void onCreate() {
    super.onCreate();
    MobileCore.setApplication(this);
    MobileCore.setLogLevel(LoggingMode.VERBOSE);
    }
  3. Create a new try...catch block to configure the Adjust Extension:

    Main.as
    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.

    Main.as
    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.
    Main.as
    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.

    Main.as
    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.

    Main.as
    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>

    Your list of extensions.

    Main.as
    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.

    Main.as
    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 SDK. After you launch your app, you should see the message Install tracked.