Integrate the Cordova Plugin with Capacitor or Ionic Apps

Use the Cordova Plugin to integrate the Engagement SDK into Ionic and Capacitor applications. For detailed installation and setup instructions, see Marketing Cloud Cordova Plugin.

To integrate Capacitor or Ionic apps with the SDK, configure the Cordova plugin by modifying your application’s configuration file.

For Ionic apps, modify the capacitor.config.ts file and add preferences under cordova, as shown in this example.

For Capacitor apps, modify the capacitor.config.json file and add preferences under cordova, as shown in this example.

Complete these steps each time you add the platform to your Capacitor app.

Copy the google-services.json file into the YOUR_APP/android/app/ directory.

  1. Enable push notifications in the Capabilities settings for your target in Xcode by clicking + Capability and then selecting Push Notifications.

    Enabling Push on iOS Apps

  2. Enable iOS push notifications by adding this code to AppDelegate.

    The SFMCSDK module is included in the dependency packages for the SDK. Don’t install it separately or list it in your podfile.

    Also add this code to the end of the AppDelegate.swift file.

If you use TypeScript with your app, declare the plugin before you call the APIs, as shown in this example.