Last modified November 24, 2022 by Shelly Wolfe

Unity SDK upgrade guide

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

Version 9.0.0

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

  • Unity 2019 is end-of-life. Unity 2020 is now the minimum LTS.
  • Unity has deprecated the iOS Notifications Services API and we have migrated to the Mobile Notifications Package. Please update your package to the latest version using the Unity Package Manager.

The following table lists the methods and fields that have changed or been moved.

Removed Summary
SwrveTriggeredMessageListener Use embedded campaigns to customize the rendering of in-app messages.
SwrveConfig.PushNotificationEvents Use SwrveConfig.PushNotificationPermissionEvents to trigger notification prompts on Android 13 and iOS.
ISwrvePushNotificationListener.OnRemoteNotification(UnityEngine.iOS.RemoteNotification notification) Use ISwrvePushNotificationListener.OnRemoteNotification(Unity.Notifications.iOS.iOSNotification notification)

Requesting push notification permission for Android and iOS

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.

In earlier versions, the default behaviour on iOS automatically triggered the push permission prompt on a user’s first app session, unless you configured the SwrveConfig.PushNotificationEvents API to trigger the request using specific events.

With the release of version 9.0.0, we’ve replaced the API with SwrveConfig.PushNotificationPermissionEvents, which you should now use to trigger the prompt for both Android 13+ and iOS. This is now required to get push permission from all users.

To configure the notification permission request:

  1. Set the Android targetSdk to at least API Level 33 to ensure the permission prompt is not displayed upon install for Android users.
  2. The SwrveConfig.PushNotificationPermissionEvents API captures a HashSet of string event names. Configure the API with a list of special event names to trigger the prompt.

Multiple push providers on Android

If using multiple push providers on Android, please update your Java or Kotlin FirebaseMessagingService class to use the following new API: SwrvePushServiceDefault.handle(Context context, Map<String, String> data, String messageId, long sentTime)


Version 8.4.2

There are no code changes required to upgrade to Swrve Unity SDK v8.4.2.


Version 8.4.1

There are no code changes required to upgrade to Swrve Unity SDK v8.4.1.


Version 8.4.0

There are no code changes required to upgrade to Swrve Unity SDK v8.4.0.


Version 8.3.0

There are no code changes required to upgrade to Swrve Unity SDK v8.3.0.


Version 8.2.0

There are no code changes required to upgrade to Swrve Unity SDK v8.2.0.


Version 8.1.1

If you are upgrading from a version prior to 8.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v8.1.1.


Version 8.1.0

If you are upgrading from a version prior to 8.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v8.1.0.

If you are in the process of upgrading to Unity SDK v8.1.0, please use v8.1.1 instead, as it addresses an important fix to push influenced events that was introduced in version 8.1.0. Do not use Unity SDK v8.1.0.

Version 8.0.0

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

We’ve made several changes to the SDK to simplify integration for future releases including:

  • Moved in-app configuration to the SwrveInAppMessageConfig class.

The following table lists the methods and fields that have changed or been moved.

Removed Summary
SWRVE_LOG_IDFA Use new public API SetIDFA(value) to set the IDFA after the user has given their permission.
SwrveNotificationCustomFilter Overwrite processMessage instead.
Moved or changed Summary
DefaultBackgroundColor
InAppMessageCustomButtonListener
InAppMessageClipboardButtonListener
InAppMessageListener
TriggeredMessageListener
Moved to SwrveInAppMessageConfig.
ManagedModeAutoStartLastUser Renamed to AutoStartLastUser
ISwrveEmbeddedMessageListener.OnMessage(SwrveEmbeddedMessage message) Added an additional argument for personalization ISwrveEmbeddedMessageListener.OnMessage(SwrveEmbeddedMessage message, Dictionary personalizationProperties)

Version 7.3.2

If you are upgrading from a version prior to 7.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v7.3.2.


Version 7.3.1

If you are upgrading from a version prior to 7.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v7.3.1.


Version 7.3.0

This section provides information for upgrading to Swrve Unity SDK v7.3.0. If you are upgrading from a version prior to 7.0.0, see below.

Embedded campaigns

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


Version 7.2.0

If you are upgrading from a version prior to 7.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v7.2.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 or else regenerate your Push Android Library making sure the project_id is in file src/main/res/values/values.xml.


Version 7.1.0

If you are upgrading from a version prior to 7.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v7.1.0.


Version 7.0.2

If you are upgrading from a version prior to 7.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v7.0.2.


Version 7.0.1

If you are upgrading from a version prior to 7.0.0, see below. Otherwise, there are no code changes required to upgrade to Swrve Unity SDK v7.0.1.


Version 7.0.0

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

Removed Summary
SetConversationVersion(int) We no longer support directly changing the conversation version that your instance is expecting. We will always set the latest conversation version that the current SDK supports.
Changed
config.AndroidPushNotificationAccentColor to config.AndroidPushNotificationAccentColorHex Changed the notification accent color configuration from RGB to Hex.

AndroidX

We have migrated the Android Native plugin from android-support over to AndroidX. For more information please see Android’s Migrating to AndroidX guide.

Firebase Cloud Messaging library update

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

Delayed initialization and custom user ID

For information about how to configure the SDK to delay initialization and set a custom user ID for tracking purposes, see the Unity integration guide.


Previous versions

If you are upgrading from a version older than 7.0.0, please refer to the Unity integration guide.