Migrating from 2.3

Batch Cordova Plugin 3.0 is a major release, which introduces breaking changes from 2.x. This guide describes how to update the plugin in an application already using Batch Cordova Plugin 2.3.

Minimum Cordova version

Cordova and Ionic (CLI, android/iOS plugins) version requirements are higher than 2.3. Please see SDK Integration for the updated requirements.

Support for iOS 8 and 9 has been dropped.

Plugin Name

As of version 3.0, the plugin has moved under the batch npm group. It is now named @batch.com/cordova-plugin.

In order to update to 3.0, remove the old plugin and add the new one. The old plugin will stay published at version 2.3.

cordova plugin remove com.batch.cordova
cordova plugin add @batch.com/cordova-plugin

Since cordova doesn't support these names in its plugin name, the plugin is still named com.batch.cordova after installation. This might affect how you interact with the plugin using Cordova's CLI.
Example:

cordova plugin add @batch.com/cordova-plugin
cordova plugin remove com.batch.cordova

Ionic Cordova and Ionic Capacitor users need to take similar steps.

Androidx

Batch Cordova Plugin 3.0 requires androidx to be enabled in your project.

See the SDK Integration documentation for more info.

Firebase Cloud Messaging

Version 2.x of the plugin came with automatic Firebase integration, which consisted of:

  • An explicit Android dependency
  • A Cordova hook to copy required data from google-services.json

This caused a lot of incompatibilities with the different Firebase plugins used in the Cordova ecosystem, so we removed this.
On Android, Batch Cordova Plugin 3.0 needs Firebase Cloud Messaging to be added using the third party plugin: see the SDK Integration documentation for more info.

The explicit dependency on androidx.appcompat has also been removed to reduce version mismatch problems: while it is still required to be able to display Mobile Landings and In-App Campaigns, this dependency should be automatically added by Firebase.

Note: Batch doesn't require Firebase Cloud Messaging on iOS. You can safely install an Android-only plugin.

iOS Framework integration

This change should be transparent, but might require cleaning the project: on iOS, Batch's native framework isn't shipped with the plugin anymore but is fetched using Cocoapods.