Last modified January 29, 2024 by Shelly Wolfe

Android SDK upgrade guide

This guide provides information about how you can upgrade to the latest Swrve Android SDK. For information about the changes that have been made in each Android SDK release, see Android SDK release notes.

Upgrading using Gradle

If you use Gradle to integrate the Android SDK, update the build.gradle to use the latest version (for example, implementation 'com.swrve.sdk.android:swrve-firebase:10.14.0'). For more information, see the Android integration guide.


Version 10.14.0

There are no code changes required to upgrade to Swrve Android SDK v10.14.0.


Version 10.13.0

There are no code changes required to upgrade to Swrve Android SDK v10.13.0.


Version 10.12.0

This section provides information for upgrading to Swrve Android SDK v10.12.0.

Upgrade to Huawei Push Services

To use Huawei Push Services, update the version of the Gradle plugin dependency (agcp) to 1.9.1.301.


Version 10.11.2

There are no code changes required to upgrade to Swrve Android SDK v10.11.2.


Version 10.11.1

There are no code changes required to upgrade to Swrve Android SDK v10.11.1.


Version 10.11.0

This section provides information for upgrading to Swrve Android SDK v10.11.0.

The following table lists the methods and fields that have changed or been removed:

Changed To
SwrveCustomButtonListener The SwrveCustomButtonListener API is now deprecated. Please use SwrveInAppMessageListener instead to get campaign and button metadata.
SwrveDismissButtonListener The SwrveDismissButtonListener API is now deprecated. Please use SwrveInAppMessageListener instead to get campaign and button metadata.
SwrveClipboardButtonListener The SwrveClipboardButtonListenerAPI is now deprecated. Please use SwrveInAppMessageListener instead to get campaign and button metadata.

Version 10.10.1

There are no code changes required to upgrade to Swrve Android SDK v10.10.1.


Version 10.10.0

There are no code changes required to upgrade to Swrve Android SDK v10.10.0.


Version 10.9.2

There are no code changes required to upgrade to Swrve Android SDK v10.9.2.


Version 10.9.1

There are no code changes required to upgrade to Swrve Android SDK v10.9.1.


Version 10.9.0

This section provides information for upgrading to Swrve Android SDK v10.9.0.

Permission requests via in-app message

To request push permissions via an in-app message, you must include the permission in your AndroidManifest.xml. For more information, see the Android integration guide.

The following table lists the methods and fields that have changed or been removed:

Changed To
SwrveEmbeddedMessageListener The SwrveEmbeddedMessageListener API is now deprecated. Please use SwrveEmbeddeListener instead which adds a control flag to determine if Control or Treatment campaign

Version 10.8.0

There are no code changes required to upgrade to Swrve Android SDK v10.8.0.


Version 10.7.0

There are no code changes required to upgrade to Swrve Android SDK v10.7.0.


Version 10.6.0

There are no code changes required to upgrade to Swrve Android SDK v10.6.0.


Version 10.5.0

This section provides information for upgrading to Swrve Android SDK v10.5.0.

  • For implementations with other push providers, please use SwrvePushServiceDefault.handle(Context context, Map<String, String> data, String messageId, long sentTime).
  • All other SwrvePushServiceDefault API’s are deprecated.

Version 10.4.0

This section provides information for upgrading to Swrve Android SDK v10.4.0.

Requesting push permissions in Android 13

With the release of Android 13, users must actively grant permission for an app to display notifications on their device. To improve permission opt-in rates, Android recommends waiting until an opportune time to display the permission prompt.

To configure the notification permission request:

  1. Set the targetSdkVersion for the app in your build.gradle file to at least API Level 33.
  2. Configure the pushNotificationPermissionEvents API in SwrveNotificationConfig with a list of special event names to trigger the prompt.
  3. When a user triggers one of the events, the permission prompt is displayed.

Upgrade to Huawei Push Services

To use Huawei Push Services, update the version of the Gradle plugin dependency (agcp) to 1.7.2.300.


Version 10.3.0

There are no code changes required to upgrade to Swrve Android SDK v10.3.0.


Version 10.2.0

There are no code changes required to upgrade to Swrve Android SDK v10.2.0.


Version 10.1.0

There are no code changes required to upgrade to Swrve Android SDK v10.1.0.


Version 10.0.0

This section provides information for upgrading to Swrve Android SDK v10.0.0.

The Swrve SDK now has a minSdkVersion value of 19, which means you must update the minSdkVersion value in your build.gradle to 19.

The following table lists the methods and fields that have changed or been removed:

Changed To
SwrveInAppMessageConfig The default button focus behavior for in-app message campaigns will now adjust the size of the focused button instead of adjusting the color of the button. The focusColor configuration has been removed from SwrveInAppMessageConfig. Use the SwrveMessageFocusListener to configure your own default behavior.
SwrveCustomButtonListener.onAction Now contains an extra string argument for the campaign name.
SwrveDismissButtonListener.onAction Now contains an extra string argument for the campaign name.
Removed Summary
SwrveMessageListener Method no longer needed. Use embedded campaigns to customize how in-app messages are rendered.
SwrveSDK.sessionEnd() Method no longer needed.

Version 9.4.0

There are no code changes required to upgrade to Swrve Android SDK v9.4.0.


Version 9.3.1

There are no code changes required to upgrade to Swrve Android SDK v9.3.1.


Version 9.3.0

There are no code changes required to upgrade to Swrve Android SDK v9.3.0.


Version 9.2.0

There are no code changes required to upgrade to Swrve Android SDK v9.2.0.


Version 9.1.0

There are no code changes required to upgrade to Swrve Android SDK v9.1.0.


Version 9.0.0

This section provides information for upgrading to Swrve Android SDK v9.0.0.

  • The Swrve SDK now has a minCompileSdk value of 31, which means you must update the compileSdkVersion value in your build.gradle to 31.
  • If you are using Google Play services advertising ID, you must now include the library dependency in your build.gradle. For example:
    api 'com.google.android.gms:play-services-ads-identifier:17.1.0'.

Version 8.0.0

This section provides information for upgrading to Swrve Android SDK v8.0.0.

The following table lists the methods and fields that have changed or been removed:

Changed To
SwrveConfig.ManagedModeAutoStartLastUser SwrveConfig.AutoStartLastUser
SwrveMessagePersonalisationProvider.java SwrveMessagePersonalizationProvider.java
SwrveInAppMessageConfig.Builder.personalisationProvider SwrveInAppMessageConfig.Builder.personalizationProvider
SwrveInAppMessageConfig.Builder.personalisedTextBackgroundColor SwrveInAppMessageConfig.Builder.personalizedTextBackgroundColor
SwrveInAppMessageConfig.Builder.personalisedTextForegroundColor SwrveInAppMessageConfig.Builder.personalizedTextForegroundColor
SwrveInAppMessageConfig.Builder.personalisedTextTypeface SwrveInAppMessageConfig.Builder.personalizedTextTypeface
SwrveEmbeddedMessageListener.onMessage(Context context, SwrveEmbeddedMessage message); SwrveEmbeddedMessageListener.onMessage(Context context, SwrveEmbeddedMessage message, Map<String, String> personalizationProperties);
Removed Summary
SwrveConfig.LoadCachedCampaignsAndResourcesOnUIThread Method no longer needed.

Version 7.6.1

This section provides information for upgrading to Swrve Android SDK v7.6.1.

Migration to Maven Central

Add mavenCentral() to your root build.gradle file allprojects/repositories section:

repositories {
    mavenCentral()
}

Version 7.6.0

There are no code changes required to upgrade to Swrve Android SDK v7.6.0.

Support for Huawei Push Services

For information on using the new Swrve Huawei SDK library for Huawei push notifications, see the Android integration guide.


Version 7.5.0

There are no code changes required to upgrade to Swrve Android SDK v7.5.0.


Version 7.4.0

This section provides information for upgrading to Swrve Android SDK v7.4.0.

Embedded campaigns

For information on adding embedded campaigns to your Swrve integration, see the Android integration guide.


Version 7.3.2

There are no code changes required to upgrade to Swrve Android SDK v7.3.2.


Version 7.3.1

There are no code changes required to upgrade to Swrve Android SDK v7.3.1.


Version 7.3.0

There are no code changes required to upgrade to Swrve Android SDK v7.3.0.

Firebase Instance ID exceptions

The Firebase messaging library now validates your google-services.json file and throws an IllegalArgumentException if problems are found. If you see this exception in Logcat, then refresh your google-services.json file from the Firebase console.


Version 7.2.1

There are no code changes required to upgrade to Swrve Android SDK v7.2.1.


Version 7.2.0

There are no code changes required to upgrade to Swrve Android SDK v7.2.0.


Version 7.1.0

This section provides information for upgrading to Swrve Android SDK v7.1.0.

Amazon Device Messaging (ADM) 1.1.0

We updated the ADM library to 1.1.0, which brings support for Fire OS7. To upgrade to this version, add the following entry in your AndroidManifest.xml under the application tag:

<service android:name="com.swrve.sdk.SwrveAdmHandlerJobService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

For information about ADM, see the Amazon Developer docs.


Version 7.0.0

This section provides information for upgrading to Swrve Android SDK v7.0.0.

Removed Summary
SwrveNotificationCustomFilter We removed the deprecated SwrveNotificationCustomFilter. Please use SwrveNotificationFilter instead, which exposes more details of the notification than its predecessor.
Changed Summary
SwrveNotificationConfig.accentColorResourceId
to SwrveNotificationConfig.accentColorHex
Changed the notification accent color configuration from RGB to Hex.
Moved To
SwrveCustomButtonListener Moved from com.swrve.sdk.SwrveSDKBase to com.swrve.sdk.config.SwrveInAppMessageConfig. This listener needs to be set before starting the Swrve SDK as part of the config object.
SwrveDismissButtonListener Moved from com.swrve.sdk.SwrveSDKBase to com.swrve.sdk.config.SwrveInAppMessageConfig. This listener needs to be set before starting the Swrve SDK as part of the config object.
DismissButtonListener Moved from com.swrve.sdk.SwrveSDKBase to com.swrve.sdk.config.SwrveInAppMessageConfig, This listener needs to be set before starting the Swrve SDK as part of the config object.
defaultBackgroundColor Moved from com.swrve.sdk.SwrveConfigBase to com.swrve.sdk.config.SwrveInAppMessageConfig
inAppMessageFocusColor Moved from com.swrve.sdk.config.SwrveConfigBase to com.swrve.sdk.config.SwrveInAppMessageConfig and renamed to focusColor.
inAppMessageClickColor Moved from com.swrve.sdk.config.SwrveConfigBase to com.swrve.sdk.config.SwrveInAppMessageConfig and renamed to clickColor.
autoShowMessagesMaxDelay Moved from com.swrve.sdk.config.SwrveConfigBase to com.swrve.sdk.config.SwrveInAppMessageConfig.

AndroidX

We have migrated from android-support to AndroidX. For more information, see Android’s Migrating to AndroidX guide.

Firebase Cloud Messaging library update

We’ve updated Firebase Cloud Messaging to version 20.1.0 and dropped support for Android 14 and 15. When upgrading to Swrve Android SDK 7.0 ensure your minimum Android support is at 16.


Previous versions

If you are upgrading from a version older than 7.0.0, please refer to the Android Integration Guide.