Edit in GitHubLog an issue

Migrate to latest Adobe Experience Platform Mobile SDKs for Android

If you have implemented the previous versions of the Android Mobile SDKs, then this guide will help you understand the steps required to migrate to the latest version. In summary, you will need to:

  1. Switch Gradle dependencies to latest versions
  2. Update SDK initialization
  3. Replace the deprecated API calls with the new API calls

Switch Gradle dependencies to latest versions

At this time, the previous versions of the Android Mobile SDKs may be switched out with their respective latest version. See instructions on proceeding further if you have manually imported SDK libraries , or if you used Gradle to manage SDK dependencies.

SDK NameLatest Version
sdk-core
userprofile
Maven Central
assurance
Maven Central
edge
Maven Central
edgeidentity
Maven Central
edgeconsent
Maven Central
messaging
Maven Central
optimize
Maven Central
analytics
Maven Central
audience
Maven Central
target
Maven Central
media
Maven Central
places
Maven Central
campaign
Maven Central
campaignclassic
Maven Central

Manual library import

If you are manually importing the Mobile SDK libraries, update your app dependencies to the latest versions shown in the table above.

Gradle

If you are using Gradle to manage your app dependencies, the following example shows how to upgrade to latest version in the build.gradle file.

Copied to your clipboard
dependencies {
//replace sdk-core with Core/Lifecycle/Identity/Signal 2.0
//implementation 'com.adobe.marketing.mobile:sdk-core:1.+'
implementation 'com.adobe.marketing.mobile:core:2.+'
implementation 'com.adobe.marketing.mobile:lifecycle:2.+'
implementation 'com.adobe.marketing.mobile:identity:2.+'
implementation 'com.adobe.marketing.mobile:signal:2.+'
//replace UserProfile 1.+ with UserProfile 2.0
//implementation 'com.adobe.marketing.mobile:userprofile:1.+'
implementation 'com.adobe.marketing.mobile:userprofile:2.+'
}

Save the build.gradle file and select Sync Project with Gradle Files in Android Studio to download the latest Android SDK.

Update SDK initialization

After you have imported the new Android libraries, you'll need to update SDK initialization code as described below. With Mobile Core version 2.0.0 and above, the MobileCore.start() API is no longer required. The SDK has simplified initialization and registration of extensions by providing the MobileCore.registerExtensions() API. After the given extensions have been registered, the SDK will be initialized and the completion block will be executed. The code which used to reside in the start() block will now reside in the MobileCore.registerExtensions()'s completion block.

The following code snippets show the recommended initialization code for the latest Mobile SDKs.

Copied to your clipboard
public class MainApp extends Application {
private static final String ENVIRONMENT_FILE_ID = "ENVIRONMENT_FILE_ID";
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID);
List<Class<? extends Extension>> extensions = new ArrayList<>();
extensions.add(Lifecycle.EXTENSION);
extensions.add(Signal.EXTENSION);
extensions.add(UserProfile.EXTENSION);
extensions.add(Assurance.EXTENSION);
extensions.add(Identity.EXTENSION);
MobileCore.registerExtensions(extensions, o -> {
Log.d(LOG_TAG, "AEP Mobile SDK is initialized");
});
}
}

Replace the deprecated API calls with the new API calls

Some of the APIs available in previous major versions of the Mobile SDK for Android are now deprecated. You can choose to replace the deprecated APIs in your code with the alternative APIs in the latest version, as described in the table below:

Deprecated APIAlternative API
EXTENSION.registerExtension
MobileCore.registerExtensions
UserProfile.updateUserAttribute
UserProfile.updateUserAttributes
UserProfile.removeUserAttribute
UserProfile.removeUserAttributes
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.