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 SDK
To start using SDK v5, you need to add it as a dependency in your project. To do this:
-
Remove any older versions of the SDK you currently have in your
build.gradle
file. -
Add the following dependencies to your
build.gradle
file:
Update the initialization method
In SDK v4, the initialization method is Adjust.onCreate(AdjustConfig)
. This has been changed to Adjust.initSdk(AdjustConfig)
in SDK v5.
Changed APIs
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 Adjust SDK to send install data to Adjust when your app comes preinstalled on a device by calling the setPreinstallTrackingEnabled
method of your AdjustConfig
instance with a boolean argument.
In SDK v5, this method has been renamed to enabledPreinstallTracking
for clarity. This new method takes no arguments.
Enable cost data in attribution
In SDK v4, you can enable the SDK to send cost data as part of a user’s attribution by calling the setNeedsCost
method of your AdjustConfig
instance with a boolean argument.
In SDK v5, this method has been renamed to enableCostDataInAttribution
for clarity. This new method takes no arguments.
Send information in background
In SDK v4, you can enable the SDK to send information to Adjust when the app is running in the background by calling the setSendInBackground
method of your AdjustConfig
instance with a boolean argument.
In SDK v5, this method has been renamed to enableSendingInBackground
. This new method takes no arguments.
Read device IDs only once
In SDK v4, you can configure the SDK to only read device IDs once upon initialization by calling the setReadDeviceInfoOnceEnabled
method of your AdjustConfig
instance with a boolean value.
In SDK v5, this method has been renamed to enableDeviceIdsReadingOnce
for clarity. This new method takes no arguments.
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.
COPPA compliance
In SDK v4, COPPA compliance is set by calling the setCoppaCompliantEnabled
method on your config object with a boolean argument.
In SDK v5, this method is renamed to enableCoppaCompliance
for clarity. This new method accepts 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 config object with a boolean argument.
In SDK v5, this method is renamed to enablePlayStoreKidsCompliance
for clarity. This new method accepts no arguments.
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.
v4 | v5 - main and fallback domain | v5 - use sub domains | v5 - is Data Residency |
---|---|---|---|
AdjustConfig.DataResidencyEU | "eu.adjust.com" | true | true |
AdjustConfig.DataResidencyTR | "tr.adjust.com" | true | true |
AdjustConfig.DataResidencyUS | "us.adjust.com" | true | true |
AdjustConfig.UrlStrategyChina | "adjust.world" , "adjust.com" | true | false |
AdjustConfig.UrlStrategyCn | "adjust.cn" , "adjust.com" | true | false |
AdjustConfig.UrlStrategyCnOnly | "adjust.cn" | true | false |
AdjustConfig.UrlStrategyIndia | "adjust.net.in" , "adjust.com" | true | false |
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.
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
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 the setUserAgent
method of your AdjustConfig
instance 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 setDeviceKnown
method of your AdjustConfig
instance 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 the setDelayStart
method on your AdjustConfig
instance with up to 120 seconds of delay. If the app is ready before the delay ends, information can be sent immediately by calling Adjust.sendFirstPackages
.
Both of these methods have been removed in SDK v5.
Reattribution using deep links
In SDK v4, you can pass a deep link URL to Adjust in the Web bridge by calling the Adjust.appWillOpenUrl()
method.
This method has been removed in SDK v5.
Send ad revenue from a specific source
In SDK v4, you can send ad revenue from a specific source by passing a source and payload to the Adjust.trackAdRevenue()
method.
This method has been removed in SDK v5.
Set an App Secret
SDK v4 supports setting an App Secret by calling the setAppSecret
method of your AdjustConfig
instance to sign the SDK traffic with.
This setting has been removed in SDK v5.