Skip to main content

Cordova Integration

This guide will help you configure your Cordova app for ChottuLink Dynamic Links. You can complete this setup either during the initial onboarding or later from your project settings.

Using Capacitor or Ionic?

This guide is for plain Apache Cordova projects. If your app is built on Capacitor (including Ionic), use the Capacitor Integration guide instead — the JavaScript API and payload shapes are identical between the two SDKs.

Prerequisites​

Before integrating ChottuLink into your Cordova app, ensure you have the following:

Development Environment​

  • Node.js 16.x or later installed
  • Cordova CLI 9.0.0+ installed (npm install -g cordova)
  • A working Cordova project
  • Xcode 16.2 or later installed (for iOS development)
  • Android Studio or other IDE with Android SDK installed (for Android development)
  • Physical devices or simulators/emulators to run your app

Project Requirements​

  • cordova-android 10.0.0+
  • cordova-ios 6.0.0+
  • Android 5.0+ (API 21+) minimum SDK (if building for Android)
  • iOS 15.6+ deployment target (if building for iOS)

1. For iOS Click here​

2. For Android Click here​

Installation​

Install the plugin and pass it the domain that serves your links, without a scheme (e.g. yourapp.chottu.link):

cordova plugin add cordova-plugin-chottulink-sdk \
--variable CHOTTULINK_DOMAIN=yourapp.chottu.link
CHOTTULINK_DOMAIN is required

This value is written into the Android App Links intent filter and the iOS Associated Domains entitlement at install time. Leaving it out fails silently at runtime instead of at build time, so deep links simply won't open your app.

Platform Specific Configurations​

1. For Android​

No manual manifest editing is required. The plugin's installer already adds, to your project's AndroidManifest.xml:

  • The INTERNET permission
  • An autoVerify App Links intent filter on your app's MainActivity, scoped to https:// + the domain you passed as CHOTTULINK_DOMAIN

This is applied automatically every time you add or re-add the plugin.

2. For iOS​

Set the deployment target​

This step is required, not optional. cordova-ios generates a project with a deployment target below the SDK's minimum of 15.6, which produces linker warnings and can crash at launch on older devices. Add this to your project's config.xml:

<platform name="ios">
<preference name="deployment-target" value="15.6" />
</platform>

Then re-run:

cordova prepare ios

Enable Associated Domains on your App ID​

The plugin automatically writes the Associated Domains entitlement (applinks:yourapp.chottu.link) into your iOS build's Debug and Release plists. However, the capability must also be enabled for your App ID in the Apple Developer portal, with your provisioning profile regenerated afterward. Without that, the entitlement is stripped at signing and Universal Links silently stop working.

Cordova plugins become available only after the deviceready event fires, so every call into ChottuLink must happen after that point.

You can get the Mobile SDK Integration Key from the ChottuLink Dashboard Keys section.

Example: JavaScript​

document.addEventListener('deviceready', function () {
// Replace "YOUR_API_KEY" with your real API Key from the ChottuLink Dashboard Keys section.
ChottuLink.initialize({ apiKey: 'YOUR_API_KEY' })
.then(function () {
console.log('✅ ChottuLink initialized successfully');
})
.catch(function (error) {
console.error('❌ Error initializing ChottuLink:', error);
});
}, false);

Example: TypeScript​

Type declarations ship with the plugin, so ChottuLink is typed even though it's accessed as a global:

import type { ChottuLinkPlugin } from 'cordova-plugin-chottulink-sdk';

declare const ChottuLink: ChottuLinkPlugin;

document.addEventListener('deviceready', () => {
ChottuLink.initialize({ apiKey: 'YOUR_API_KEY' })
.then(() => console.log('✅ ChottuLink initialized successfully'))
.catch((error) => console.error('❌ Error initializing ChottuLink:', error));
}, false);
Important Note
  • Always initialize the ChottuLink SDK after deviceready, and before creating or resolving links
  • Make sure to replace YOUR_API_KEY with your actual API key from the ChottuLink Dashboard
  • If you need to react to the link that launched your app (including a cold start), register your addListener calls before calling initialize — see Receive Dynamic Links

Next Steps​

After completing the Cordova setup:

  1. Create your first Dynamic Link
  2. Receive Dynamic Link