Migrating from v2
Batch SDK v3 is a major release, which introduces breaking changes from 2.x. This guide describes how to update your application when using a previous version.
If your application is still using Batch SDK v1 please follow our migration guide from V1 beforehand.
Upgrading the SDK version
To upgrade from v2 to v3, you need to change the SDK version in your build.gradle:
implementation("com.batch.android:batch-sdk:3.0.0")implementation 'com.batch.android:batch-sdk:3.0.0'Core migration
Compile and Target SDK
Batch SDK v3 now compiles with Android SDK 36 (Android 16 'Baklava').
Even this is not mandatory we recommend you to ensure your project's compileSdk and targetSdk are updated accordingly in your build.gradle file.
android {
...
compileSdk = 36
...
defaultConfig {
...
targetSdk = 36
}
}android {
...
compileSdk 36
defaultConfig {
...
targetSdk 36
}
}Internal Kotlin Usage
Batch now uses Kotlin (1.9.0) internally. This should not affect your existing Java-based integrations as public APIs remain in Java. However, be aware of this change if you are inspecting the SDK's internals or if you encounter any unexpected behavior related to Kotlin interoperability.
Push migration
Managing notification display
Methods setNotificationsType and getNotificationsType in Batch.Push have been removed.
Please replace their usage with the following methods:
Batch.Push.setShowNotifications(show: boolean): Use this to control whether Batch should display push notifications.Batch.Push.shouldShowNotifications():Use this to check if Batch is configured to show push notifications.
So, if you were doing something like this in your application :
You should now do:
For more information, please visit the managing notification display section.
Messaging migration
Batch SDK v3 adds compatibility for Mobile Landings with Push v2 which can be created from the Batch Dashboard's drag & drop composer.
In-App Message Interception
The interface Batch.Messaging.LifecycleListener2 has been removed. Please replace its usage with the new Batch.Messaging.InAppInterceptor interface.
Use the method Batch.Messaging.setInAppInterceptor(Batch.Messaging.InAppInterceptor interceptor) to set your custom interceptor.
So if you were doing:
You should now do:
For more information, please see the In-App messaging manual mode section.
Messaging Lifecycle Listener
The following methods in Batch.Messaging.LifecycleListener have been removed:
onBatchMessageCancelledByAutocloseonBatchMessageCancelledByUseronBatchMessageCancelledByErroronBatchMessageWebViewActionTriggered
Please update your implementation to use the new onBatchMessageClosed(String messageIdentifier, MessagingCloseReason reason) method. The new MessagingCloseReason enum will provide the context about why the message was closed.
WebView actions will now trigger the updated onBatchMessageActionTriggered method, with the analyticsID of the action being passed as the ctaIdentifier.
The index (Int) parameter in onBatchMessageActionTriggered has been replaced by ctaIdentifier (String). The method signature is now:
For older MEP (Mobile Engagement Platform) messages, ctaIdentifier will be a string in the format "mepCtaIndex:" + index.
The constant GLOBAL_TAP_ACTION_INDEX now returns a String instead of an int. Update any comparisons or usage accordingly.
So if you were doing:
You should now do:
For more information, please see the listening lifecycle event section.
Manual display mode
The messaging manual display mode has been reworked to better fit Mobile Landing on Push v2.
What's changed:
The enum
Formatand the methodgetFormat()inBatchMessagehave been removed.The methods
loadFragment()andloadBanner()inBatch.Messaginghave been removed.The class
BatchBannerViewhas been removed.
You should now use the new method Batch.Messaging.loadMessagingView(Context context, BatchMessage message) to load messages.
This method will returns an instance of BatchMessagingView which according to the kind property allows you to use the right method to display it.
So if you were doing something like:
You should now do:
For more information, please visit the Mobile Landing manual mode section.
To see in details what's precisely changed since V2 please consult our changelog or visit the APIs Reference.
Last updated

