SDK v5 is in open beta. All features are subject to change.
Before you begin
Here’s what you need to do before updating to SDK v5:
- SDK v5 supports SDK signature verification natively. If you currently use the SDK signature library, you need to uninstall this first.
- 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:
-
Add the beta repository to your
build.gradle
file.build.gradle repositories {maven {url "https://oss.sonatype.org/content/repositories/snapshots/"}} -
Remove any older versions of the SDK you currently have in your
build.gradle
file. -
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 appimplementation 'com.adjust.sdk:adjust-android-webbridge:5.0.0-SNAPSHOT'}
Changes
SDK v5 is a major version update. This means there are breaking changes that require you to update your code.
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.
Adjust.onCreate(adjustConfig) // v4Adjust.initSdk(adjustConfig) // v5
Adjust.onCreate(adjustConfig); // v4Adjust.initSdk(adjustConfig); // 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
Adjust.setEnabled(false) // disable SDKAdjust.setEnabled(true) // enable SDK
Adjust.setEnabled(false); // disable SDKAdjust.setEnabled(true); // enable 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.
Adjust.disable() // disable SDKAdjust.enable() // enable SDK
Adjust.disable(); // disable SDKAdjust.enable(); // enable SDK
Offline mode
In SDK v4, you can enable and disable offline mode in the SDK by calling Adjust.setOfflineMode()
with a boolean
value.
Adjust.setOfflineMode(false) // put SDK in offline modeAdjust.setOfflineMode(true) // put SDK back in online mode
Adjust.setOfflineMode(false); // put SDK in offline modeAdjust.setOfflineMode(true); // put SDK back in online mode
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.
Adjust.switchToOfflineMode() // put SDK in offline modeAdjust.switchBackToOnlineMode() // put SDK back in online mode
Adjust.switchToOfflineMode(); // put SDK in offline modeAdjust.switchBackToOnlineMode(); // put SDK back in 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.
adjustConfig.setEventBufferingEnabled(true)
adjustConfig.setEventBufferingEnabled(true);
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.
adjustConfig.setUserAgent("user_agent_value")
adjustConfig.setUserAgent("user_agent_value");
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.
adjustConfig.setDeviceKnown(true)
adjustConfig.setDeviceKnown(true);
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.
adjustConfig.setDelayStart(delay)
adjustConfig.setDelayStart(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.
Adjust.addSessionCallbackParameter("foo", "bar")Adjust.removeSessionCallbackParameter("foo")Adjust.resetSessionCallbackParameters()
Adjust.addGlobalCallbackParameter("foo", "bar")Adjust.removeGlobalCallbackParameter("foo")Adjust.removeGlobalCallbackParameters()
Adjust.addSessionCallbackParameter("foo", "bar");Adjust.removeSessionCallbackParameter("foo");Adjust.resetSessionCallbackParameters();
Adjust.addGlobalCallbackParameter("foo", "bar");Adjust.removeGlobalCallbackParameter("foo");Adjust.removeGlobalCallbackParameters();
Session partner parameters
Session partner parameters has been renamed to Global partner parameters in SDK v5.
Adjust.addSessionPartnerParameter("foo", "bar")Adjust.removeSessionPartnerParameter("foo")Adjust.resetSessionPartnerParameters()
Adjust.addGlobalPartnerParameter("foo", "bar")Adjust.removeGlobalPartnerParameter("foo")Adjust.removeGlobalPartnerParameters()
Adjust.addSessionPartnerParameter("foo", "bar");Adjust.removeSessionPartnerParameter("foo");Adjust.resetSessionPartnerParameters();
Adjust.addGlobalPartnerParameter("foo", "bar");Adjust.removeGlobalPartnerParameter("foo");Adjust.removeGlobalPartnerParameters();
Event deduplication
In SDK v4, event deduplication is coupled with the event order ID
and is limited to a maximum of 10 unique IDs.
val event = AdjustEvent("event_token")event.setOrderId("deduplication_id")Adjust.trackEvent(event)
AdjustEvent event = new AdjustEvent("event_token");event.setOrderId("deduplication_id");Adjust.trackEvent(event);
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.
val adjustConfig = AdjustConfig(this, appToken, environment)
adjustConfig.setEventDeduplicationIdsMaxSize(20) // if not set, then 10Adjust.initSdk(adjustConfig)
val event = AdjustEvent("event_token")event.setDeduplicationId("deduplication_id")Adjust.trackEvent(event)
AdjustConfig adjustConfig = new AdjustConfig(this, appToken, environment);
adjustConfig.setEventDeduplicationIdsMaxSize(20); // if not set, then 10Adjust.initSdk(adjustConfig);
AdjustEvent event = new AdjustEvent("event_token");event.setDeduplicationId("deduplication_id");Adjust.trackEvent(event);
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.
Deep linking
This section covers changes to deep linking in SDK v5.
Reattribution using deep links
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.
Adjust.appWillOpenUrl(data, applicationContext) //v4Adjust.processDeeplink(data, applicationContext) //v5
Adjust.appWillOpenUrl(data, getApplicationContext()); //v4Adjust.processDeeplink(data, getApplicationContext()); //v5
Deferred deep linking callback
In SDK v4, you can call the setOnDeeplinkResponseListener
method to handle deferred deep link callbacks.
adjustConfig.setOnDeeplinkResponseListener { deeplink -> Log.d("example", "Deferred deep link callback called!") true}
adjustConfig.setOnDeeplinkResponseListener(new OnDeeplinkResponseListener() { @Override public boolean launchReceivedDeeplink(Uri deeplink) { Log.d("example", "Deferred deep link callback called!"); return true; } });
In SDK v5, this method is has been renamed to setOnDeferredDeeplinkResponseListener
for clarity. All arguments are the same.
adjustConfig.setOnDeferredDeeplinkResponseListener {uri -> Log.d("example", "Deferred deep link callback called!") true }
adjustConfig.setOnDeferredDeeplinkResponseListener(new OnDeferredDeeplinkResponseListener() { @Override public boolean launchReceivedDeeplink(Uri deeplink) { Log.d("example", "Deferred deep link callback called!"); return true; } });
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.
adjustConfig.setCoppaCompliantEnabled(true)
adjustConfig.setCoppaCompliantEnabled(true);
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.
Adjust.enableCoppaCompliance(applicationContext)Adjust.disableCoppaCompliance(applicationContext)
Adjust.enableCoppaCompliance(getApplicactionContext());Adjust.disableCoppaCompliance(getApplicationContext());
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.
adjustConfig.setPlayStoreKidsAppEnabled(true)
adjustConfig.setPlayStoreKidsAppEnabled(true);
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.
Adjust.enablePlayStoreKidsApp(applicationContext)Adjust.disablePlayStoreKidsApp(applicationContext)
Adjust.enablePlayStoreKidsApp(getApplicationContext());Adjust.disablePlayStoreKidsApp(getApplicationContext());
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.
val adjustAdRevenue = AdjustAdRevenue(AdjustConfig.AD_REVENUE_APPLOVIN_MAX) // v4val adjustAdRevenue = AdjustAdRevenue("applovin_max_sdk") // v5
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(AdjustConfig.AD_REVENUE_APPLOVIN_MAX); // v4AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue("applovin_max_sdk"); // v5
v4 | v5 |
---|---|
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.
adjustConfig.setUrlStrategy(AdjustConfig.DATA_RESIDENCY_EU)
adjustConfig.setUrlStrategy(AdjustConfig.DATA_RESIDENCY_EU);
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.
val domains: List<String> = mutableListOf("domain") // eg. eu.adjust.comval useSubdomains = true // or falseval isDataResidency = false // or true for data residencyadjustConfig.setUrlStrategy(domains, useSubdomains, isDataResidency)
List<String> domains = Arrays.asList("domain"); // eg. eu.adjust.comboolean useSubdomains = true; // or falseboolean isDataResidency = false; // or true for data residencyadjustConfig.setUrlStrategy(domains, useSubdomains, isDataResidency);
Check the table below to see how to configure your URL strategy in SDK v5.
v4 | v5 - main and fallback domain | v5 - use sub domains | v5 - is Data Residency |
---|---|---|---|
AdjustConfig.DATA_RESIDENCY_EU | "eu.adjust.com" | true | true |
AdjustConfig.DATA_RESIDENCY_TR | "tr.adjust.com" | true | true |
AdjustConfig.DATA_RESIDENCY_US | "us.adjust.com" | true | true |
AdjustConfig.URL_STRATEGY_CHINA | "adjust.world" , "adjust.com" | true | false |
AdjustConfig.URL_STRATEGY_CN | "adjust.cn" , "adjust.com" | true | false |
AdjustConfig.URL_STRATEGY_CN_ONLY | "adjust.cn" | true | false |
AdjustConfig.URL_STRATEGY_INDIA | "adjust.net.in" , "adjust.com" | true | false |
Examples
adjustConfig.setUrlStrategy(listOf("adjust.net.in", "adjust.com"), true, false)
adjustConfig.setUrlStrategy(listOf("adjust.world", "adjust.com"), true, false)
adjustConfig.setUrlStrategy(listOf("adjust.cn"), true, false)
adjustConfig.setUrlStrategy(listOf("eu.adjust.com"), true, true)
adjustConfig.setUrlStrategy(listOf("tr.adjust.com"), true, true)
adjustConfig.setUrlStrategy(listOf("us.adjust.com"), true, true)
config.setUrlStrategy(Arrays.asList("adjust.net.in", "adjust.com"), true, false);
adjustConfig.setUrlStrategy(Arrays.asList("adjust.world", "adjust.com"), true, false);
adjustConfig.setUrlStrategy(Arrays.asList("adjust.cn"), true, false);
adjustConfig.setUrlStrategy(Arrays.asList("eu.adjust.com"), true, true);
adjustConfig.setUrlStrategy(Arrays.asList("tr.adjust.com"), true, true);
adjustConfig.setUrlStrategy(Arrays.asList("us.adjust.com"), true, true);
Disable third party sharing globally
In SDK v4, you can call the Adjust.disableThirdPartySharing()
method to globally disable sharing information with third parties globally.
Adjust.disableThirdPartySharing(applicationContext)
Adjust.disableThirdPartySharing(getApplicationContext());
This feature has been removed from SDK v5. In SDK v5, use the Adjust.trackThirdPartySharing()
method to enable or disable third party sharing.
val adjustThirdPartySharing = AdjustThirdPartySharing(true)Adjust.trackThirdPartySharing(adjustThirdPartySharing)
AdjustThirdPartySharing adjustThirdPartySharing = new AdjustThirdPartySharing(true);Adjust.trackThirdPartySharing(adjustThirdPartySharing);
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.
Adjust.getGooglePlayInstallReferrer( applicationContext, object : OnGooglePlayInstallReferrerReadListener { override fun onInstallReferrerRead(referrerDetails: GooglePlayInstallReferrerDetails) {} override fun onFailure(message: String) {} })
AdjustHuaweiReferrer.getHuaweiAdsInstallReferrer( applicationContext, object : OnHuaweiInstallReferrerReadListener() { fun onInstallReferrerDetailsRead(referrerDetails: HuaweiInstallReferrerDetails?) {} fun onFail(message: String?) {} })
AdjustHuaweiReferrer.getHuaweiAppGalleryInstallReferrer( applicationContext, object : OnHuaweiInstallReferrerReadListener() { fun onInstallReferrerDetailsRead(referrerDetails: HuaweiInstallReferrerDetails?) {} fun onFail(message: String?) {} })
AdjustSamsungReferrer.getSamsungInstallReferrer( applicationContext, object : OnSamsungInstallReferrerReadListener() { fun onSamsungInstallReferrerRead(referrerDetails: SamsungInstallReferrerDetails?) {} fun onFail(message: String?) {} })
AdjustVivoReferrer.getVivoInstallReferrer( applicationContext, object : OnVivoInstallReferrerReadListener() { fun onVivoInstallReferrerRead(referrerDetails: VivoInstallReferrerDetails?) {} fun onFail(message: String?) {} })
AdjustXiaomiReferrer.getXiaomiInstallReferrer( applicationContext, object : OnXiaomiInstallReferrerReadListener() { fun onXiaomiInstallReferrerRead(referrerDetails: XiaomiInstallReferrerDetails?) {} fun onFail(message: String?) {} })
Adjust.getGooglePlayInstallReferrer(getApplicationContext(), new OnGooglePlayInstallReferrerReadListener() { @Override public void onInstallReferrerRead(GooglePlayInstallReferrerDetails referrerDetails) { }
@Override public void onFailure(String message) { }});
AdjustHuaweiReferrer.getHuaweiAdsInstallReferrer(getApplicationContext(), new OnHuaweiInstallReferrerReadListener() { @Override public void onInstallReferrerDetailsRead(HuaweiInstallReferrerDetails referrerDetails) { }
@Override public void onFail(String message) { }});
AdjustHuaweiReferrer.getHuaweiAppGalleryInstallReferrer(getApplicationContext(), new OnHuaweiInstallReferrerReadListener() { @Override public void onInstallReferrerDetailsRead(HuaweiInstallReferrerDetails referrerDetails) { }
@Override public void onFail(String message) { }});
AdjustSamsungReferrer.getSamsungInstallReferrer(getApplicationContext(), new OnSamsungInstallReferrerReadListener() { @Override public void onSamsungInstallReferrerRead(SamsungInstallReferrerDetails referrerDetails) { }
@Override public void onFail(String message) { }});
AdjustVivoReferrer.getVivoInstallReferrer(getApplicationContext(), new OnVivoInstallReferrerReadListener() { @Override public void onVivoInstallReferrerRead(VivoInstallReferrerDetails referrerDetails) { }
@Override public void onFail(String message) { }});
AdjustXiaomiReferrer.getXiaomiInstallReferrer(getApplicationContext(), new OnXiaomiInstallReferrerReadListener() { @Override public void onXiaomiInstallReferrerRead(XiaomiInstallReferrerDetails referrerDetails) { }
@Override public void onFail(String message) { }});
Device ID getters
In SDK v4, all device ID getter methods run synchronously. In SDK v5, these methods have been changed to run asynchronously.
Adjust.getAdid { adid -> // read adid}
Adjust.getAttribution {attribution -> // read attribution}
AdjustOaid.getOaid(applicationContext, object : OnOaidReadListener() { fun onOaidRead(oaid: String?) {} fun onFail(message: String?) {} })
Adjust.getAmazonAdId(applicationContext, object : OnAmazonAdIdReadListener { override fun onAmazonAdIdRead(amazonAdId: String) {} override fun onFail(message: String) {} })
Adjust.getSdkVersion {sdkVersion -> // read sdk version}
Adjust.isEnabled(applicationContext) { isEnabled -> // read isEnabled}
Adjust.getAdid(new OnAdidReadListener() { @Override public void onAdidRead(String adid) { }});
Adjust.getAttribution(new OnAttributionReadListener() { @Override public void onAttributionRead(AdjustAttribution attribution) { }});
AdjustOaid.getOaid(getApplicationContext(), new OnOaidReadListener() { @Override public void onOaidRead(String oaid) { }
@Override public void onFail(String message) { }});
Adjust.getAmazonAdId(getApplicationContext(), new OnAmazonAdIdReadListener() { @Override public void onAmazonAdIdRead(String amazonAdId) { }
@Override public void onFail(String message) { }});
Adjust.getSdkVersion(new OnSdkVersionReadListener() { @Override public void onSdkVersionRead(String sdkVersion) { }});
Adjust.isEnabled(getApplicationContext(), new OnIsEnabledListener() { @Override public void onIsEnabledRead(boolean isEnabled) {
}});
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:
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:
-
Add the following dependency to your
build.gradle
file:build.gradle dependencies {implementation 'com.adjust.sdk:adjust-android-meta-referrer:5.0.0-SNAPSHOT'} -
Find your Meta app ID in your App Dashboard. See Meta’s App Dashboard documentation for more information.
-
Pass your App ID as a
String
argument to theAdjustConfig.setFbAppId
method.
val config = AdjustConfig(this, appToken, environment)config.setFbAppId(<FB_APP_ID_STRING>)Adjust.initSdk(config)
AdjustConfig config = new AdjustConfig(this, appToken, environment);config.setFbAppId(<FB_APP_ID_STRING>);Adjust.initSdk(config);
Removed plugins
The following plugins have been removed in SDK v5:
- Criteo
- Trademob
- Sociomatic