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 SDK

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

  1. Remove any older versions of the SDK you currently have in your build.gradle file.

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

    build.gradle
    dependencies {
    implementation 'com.adjust.sdk:adjust-android:5.0.0'
    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'
    }

Update the initialization method

Changed in v5

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

Configure the SDK Signature library

SDK v5 includes the SDK signature library. You can test this by following the testing steps in the Signature library integration guide.

Signature protection is inactive by default. To enable it, you need to:

  1. Enforce signature validation.
  2. Provide your app’s SHA-1 fingerprints prior to testing.

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

New APIs

Added in v5

The following APIs have been added in SDK v5.

Install referrer getters

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

Changed APIs

Changed in v5

The following APIs have changed in SDK v5.

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.

Preinstall recording

In SDK v4, you can enable the SDK to record activity from apps that came preinstalled on a user’s device by calling the setPreinstallTrackingEnabled method of your AdjustConfig instance with a boolean argument.

In SDK v5, this method has been renamed to enablePreinstallTracking for clarity. This method takes no arguments.

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.

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

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

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.

COPPA compliance

In SDK v4, you can mark your app as COPPA compliant by calling the setCoppaCompliantEnabled method on your AdjustConfig instance with a boolean value.

In SDK v5, this method has been renamed to enableCoppaCompliance for clarity. This method takes no arguments.

Play Store Kids Apps

In SDK v4, you can mark an app as a Play Store Kids app by calling the setPlayStoreKidsAppEnabled method on your AdjustConfig instance with a boolean argument.

In SDK v5, this method has been renamed to enablePlayStoreKidsCompliance for clarity. This method takes no arguments.

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.

v4v5
AdjustConfig.AD_REVENUE_APPLOVIN_MAX"applovin_max_sdk"
AdjustConfig.AD_REVENUE_ADMOB"admob_sdk"
AdjustConfig.AD_REVENUE_IRONSOURCE"ironsource_sdk"
AdjustConfig.AD_REVENUE_ADMOST"admost_sdk"
AdjustConfig.AD_REVENUE_UNITY"unity_sdk"
AdjustConfig.AD_REVENUE_HELIUM_CHARTBOOST"helium_chartboost_sdk"
AdjustConfig.AD_REVENUE_ADX"adx_sdk"
AdjustConfig.AD_REVENUE_SOURCE_PUBLISHER"publisher_sdk"
AdjustConfig.AD_REVENUE_TRADPLUS"tradplus_sdk"
AdjustConfig.AD_REVENUE_TOPON"topon_sdk"
AdjustConfig.AD_REVENUE_MOPUB"mopub"

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.

v4v5 - main and fallback domainv5 - use sub domainsv5 - is Data Residency
AdjustConfig.DATA_RESIDENCY_EU"eu.adjust.com"truetrue
AdjustConfig.DATA_RESIDENCY_TR"tr.adjust.com"truetrue
AdjustConfig.DATA_RESIDENCY_US"us.adjust.com"truetrue
AdjustConfig.URL_STRATEGY_CHINA"adjust.world", "adjust.com"truefalse
AdjustConfig.URL_STRATEGY_CN"adjust.cn", "adjust.com"truefalse
AdjustConfig.URL_STRATEGY_CN_ONLY"adjust.cn"truefalse
AdjustConfig.URL_STRATEGY_INDIA"adjust.net.in", "adjust.com"truefalse

Examples

Device ID getters

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

Removed APIs

Removed in v5

The following APIs have been removed in SDK v5.

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.

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.

Set an App Secret

SDK v4 supports setting an App Secret by calling setAppSecret method on your AdjustConfig instance to sign the SDK traffic with.

This setting has been removed in SDK v5.

New plugins

Added in v5

The following plugins have been added to SDK v5.

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'
}

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'
    }
  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

Removed in v5

The following plugins have been removed in SDK v5:

  • Criteo
  • Trademob
  • Sociomantic