adjust-icon

SDK v5 migration guide

Before you begin

Here’s what you need to do before updating to SDK v5:

  1. SDK v5 supports SDK signature verification natively. If you currently use the SDK signature library, you need to uninstall this first.
  2. If your app targets API versions lower than 21 you need to update your app before you can use SDK v5.

Install the beta SDK

To start using SDK v5, you need to add it as a dependency in your project. To do this:

  1. Add the beta repository to your build.gradle file.

    build.gradle
    repositories {
    maven {
    url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
    }
  2. Remove any older versions of the SDK you currently have in your build.gradle file.

  3. Add the following dependencies to your build.gradle file:

    build.gradle
    dependencies {
    implementation 'com.adjust.sdk:adjust-android:5.0.0-SNAPSHOT'
    implementation 'com.android.installreferrer:installreferrer:2.2'
    // Add the following if you are using the Adjust SDK inside web views on your app
    implementation 'com.adjust.sdk:adjust-android-webbridge:5.0.0-SNAPSHOT'
    }

Changes

Once you’ve installed the v5 SDK, you need to update your existing Adjust code to use the new APIs.

Initialization method

In SDK v4, the initialization method is Adjust.onCreate(AdjustConfig). This has been changed to Adjust.initSdk(AdjustConfig) in SDK v5.

Configuration

This section covers changes to SDK configuration.

Disable and enable the SDK

In SDK v4, you can enable and disable the SDK by calling Adjust.setEnabled() with a boolean value.

  • Call Adjust.setEnabled(false) to disable the SDK.
  • Call Adjust.setEnabled(true) to enable the SDK

In SDK v5, this feature is split into separate commands for clarity.

  • Call Adjust.disable() to disable the SDK.
  • Call Adjust.enable() to enable the SDK.

Offline mode

In SDK v4, you can enable and disable offline mode in the SDK by calling Adjust.setOfflineMode() with a boolean value.

In SDK v5, this feature is split into separate commands for clarity.

  • Call Adjust.switchToOfflineMode() to set the SDK to offline mode.
  • Call Adjust.switchBackToOnlineMode() to set the SDK back to online mode.

Event buffering

SDK v4 supports event buffering. This feature stores requests event, ad revenue, push tokens, and other information on a local buffer to send at a later date.

This setting has been removed in SDK v5.

Custom user agent string

SDK v4 supports setting a custom User Agent by calling AdjustConfig.setUserAgent() with a user agent string.

This setting has been removed in SDK v5.

Set whether a device is known

In SDK v4, you can call the AdjustConfig.setDeviceKnown() method to manually inform the SDK whether a device is known.

This setting has been removed in SDK v5.

Delay SDK start

SDK v4 supports delaying the start of the SDK by calling AdjustConfig.setDelayStart() with up to 120 seconds of delay.

This setting has been removed in SDK v5.

Recording features

This section covers changes to features that send information to Adjust.

Send session information

In SDK v4, you need to register activity lifecycle callbacks by implementing ActivityLifecycleCallbacks and calling Adjust.onResume() and Adjust.onPause() on Activity resume and pause respectively.

In SDK v5, the ActivityLifecycleCallbacks functionality is handled by the SDK. You should remove all custom activity lifecycle callbacks from your code.

Session callback parameters

Session callback parameters has been renamed to Global callback parameters in SDK v5.

Session partner parameters

Session partner parameters has been renamed to Global partner parameters in SDK v5.

Event deduplication

In SDK v4, event deduplication is coupled with the event order ID and is limited to a maximum of 10 unique IDs.

In SDK v5, the feature is decoupled from order ID. A new ID field called deduplicationId has been added for event deduplication. Users can set a custom limit on the number of deduplicationId that can be added to the list for identifying duplicate events. By default, the limit is set to 10.

AdjustAttribution class

In SDK v4, the AdjustAttribution calls has a property called adid. In SDK v5, the adid property has been removed from the AdjustAttribution class. You can retrieve the device’s ADID using the getAdid() getter method.

This section covers changes to deep linking in SDK v5.

The method used for passing deep link data to the Adjust SDK has been renamed.

  • v4: Adjust.appWillOpenUrl().
  • v5: Adjust.processDeeplink().

Both methods accept the same arguments.

Deferred deep linking callback

In SDK v4, you can call the setOnDeeplinkResponseListener method to handle deferred deep link callbacks.

In SDK v5, this method is has been renamed to setOnDeferredDeeplinkResponseListener for clarity. All arguments are the same.

Privacy features

This section covers changes to privacy features in the Adjust SDK.

COPPA compliance

In SDK v4, COPPA compliance is set using the AdjustConfig class and is read during SDK initialization. This means that the value can’t be updated once the SDK is initialized.

In SDK v5, this method is available in the Adjust class. This means that the setting can be changed at any time by calling Adjust.enableCoppaCompliance() to enable COPPA compliance or disableCoppaCompliance() to disable COPPA compliance.

Play Store Kids Apps

In SDK v4, you can mark an app as a Play Store Kids app using the AdjustConfig class. This property is read during SDK initialization, which means that the value can’t be updated once the SDK is initialized.

In SDK v5, this method is available in the Adjust class. This means that the setting can be changed at any time by calling Adjust.enablePlayStoreKidsApp() to mark the app as a Play Store Kids app or disablePlayStoreKidsApp() to unmark the app as a Play Store Kids app.

Send ad revenue from a specific source

In SDK v4, ad revenue sources are defined as constants in the AdjustConfig class. In SDK v5, ad revenue sources need to be passed as a string.

Set data residency and URL strategy

In SDK v4, URL strategy and data residency domains are defined as constants in the AdjustConfig class.

In SDK v5, you need to pass your chosen domain or domains as an array. You can also set the following:

  • useSubdomains (boolean): Whether the source should prefix a subdomain.
  • isDataResidency (boolean): Whether the domain should be used for data residency.

Check the table below to see how to configure your URL strategy in SDK v5.

Examples

Disable third party sharing globally

In SDK v4, you can call the Adjust.disableThirdPartySharing() method to globally disable sharing information with third parties globally.

This feature has been removed from SDK v5. In SDK v5, use the Adjust.trackThirdPartySharing() method to enable or disable third party sharing.

Get device information

This section covers changes to device information getters in SDK v5.

Install referrer getters

SDK v5 contains new getter methods for fetching install referrer information.

Device ID getters

In SDK v4, all device ID getter methods run synchronously. In SDK v5, these methods have been changed to run asynchronously.

Plugins

SDK v5 supports plugins to extend its functionality.

Huawei Install Referrer plugin

SDK v5 supports a Huawei Install Referrer plugin to record a device’s Huawei Install Referrer information. To add the plugin, add the following dependency to your build.gradle file:

build.gradle
dependencies {
implementation 'com.adjust.sdk:adjust-android-huawei-referrer:5.0.0-SNAPSHOT'
}

Meta Install Referrer plugin

SDK v5 supports a Meta Install Referrer plugin to record Meta Install Referrer information. To read this information:

  1. Add the following dependency to your build.gradle file:

    build.gradle
    dependencies {
    implementation 'com.adjust.sdk:adjust-android-meta-referrer:5.0.0-SNAPSHOT'
    }
  2. Find your Meta app ID in your App Dashboard. See Meta’s App Dashboard documentation for more information.

  3. Pass your App ID as a String argument to the AdjustConfig.setFbAppId method.

Removed plugins

The following plugins have been removed in SDK v5:

  • Criteo
  • Trademob
  • Sociomatic