Cordova/Capacitor SDK
To integrate the Atomic SDK into your Cordova or Capacitor app, you'll use the Atomic Web SDK. Therefore, for full documentation for the Cordova/Capacitor SDK, please see the Web SDK documentation page.
Boilerplate App
For an example of integrating the Atomic SDK in a Cordova application, see our boilerplate app on GitHub.
Installation
To use the Web SDK with your Cordova or Capacitor app:
- Download the Atomic SDK from our CDN, and bundle it with your application. You only need a single file:
https://downloads.atomic.io/web-sdk/release/26.3.0/sdk.js
Change the version number (e.g. 26.2.0) to download a specific version. For versions earlier than 26.3.0:
- Also download
iframe-manager.jsfrom the same location, and include it beforesdk.jsusing<script src="js/iframe-manager.js" id="atomic-frame-manager"></script>. - For Cordova, add
<allow-navigation href="about:*" />toconfig.xml. - If you set a Content Security Policy, include
frame-src blob:.
See the migration guide if you are upgrading from one of these versions.
-
(Cordova only): Modify the
Content-Security-Policymeta tag in your Cordova app to allow the following URLs. -
Include the
sdk.jsfile as a standalone script, added to your app as ascripttag.
We require you to download the script and include it locally, importing the script directly from the Atomic CDN will not work for a Cordova integration of the SDK.
- Enable the
cordovafeature via the stream container configuration object:
<html>
...
<body>
<!-- Include the SDK script on your page -->
<script src="js/sdk.js"></script>
<!-- Initialize the SDK (Cordova example using the deviceready event) -->
<script>
document.addEventListener('deviceready', function() {
AtomicSDK.initialise('<apiHostUrl>', '<apiKey>', '<environmentId>');
const launcherInstance = AtomicSDK.launch({
streamContainerId: '<streamContainerId>',
features: {
cordova: {
enabled: true,
},
},
});
}.bind(this), false);
</script>
</body>
</html>
Push Notifications
Full documentation on integrating support for push notifications on iOS and Android can be found in the Web SDK documentation.
Atomic delivers to iOS over APNs, so the token you pass to registerDeviceForNotifications on an iOS device must be an APNs token, not a Firebase Cloud Messaging (FCM) token. cordova-plugin-push returns an FCM token on iOS when a GoogleService-Info.plist is bundled with the iOS app. See Send the push token to the Atomic Platform for how to tell the two apart and how to configure the plugin.