Upgrade MobilePush SDK for Android From Version 8.x to 8.2.x

The MobilePush SDK for Android version 8.2.x is compiled using JDK 17. This version of the JDK meets the requirements of Gradle and Google. For more information, see the Change Log.

When you upgrade from 8.x to 8.2.x, you must make some changes to your app’s code.

Add the New MobilePush SDK for Android 

To upgrade to Android SDK version 8.2.x, add the SDK as a dependency to your build.gradle file, as shown in this example.

1implementation("com.salesforce.marketingcloud:marketingcloudsdk:8.2.x");

To use the latest SDK version, replace 8.2.x with the latest version number available on the Change Log.

Update the PushModuleReadyListener Implementation 

After you add the latest version of the SDK as a dependency and fetch that version in your project, modify your implementation of PushModuleReadyListener.

This step applies to Java-based implementations only. If your implementation uses Kotlin, skip this step.

Note

Your existing PushModuleReadyListener implementation contains code similar to this example.

1SFMCSdk.requestSdk(new SFMCSdkReadyListener() {
2  @Override
3  public void ready(@NonNull SFMCSdk sfmcSdk) {
4    sfmcSdk.mp(new PushModuleReadyListener() {
5      @Override
6      public void ready(@NonNull PushModuleInterface pushModuleInterface) {
7        pushModuleInterface.get...
8      }
9    });
10  }
11});

Update the code to add a second ready() method that accepts a ModuleInterface parameter and casts it to PushModuleInterface, as shown in this example.

1SFMCSdk.requestSdk(new SFMCSdkReadyListener() {
2  @Override
3  public void ready(@NonNull SFMCSdk sfmcSdk) {
4    sfmcSdk.mp(new PushModuleReadyListener() {
5      @Override
6      public void ready(@NonNull PushModuleInterface pushModuleInterface) {
7        pushModuleInterface.get...
8      }
9      @Override
10      public void ready(@NonNull ModuleInterface moduleInterface) {
11        this.ready((PushModuleInterface) moduleInterface);
12      }
13    });
14  }
15});