Channels for the React Native Module

Access and manage channel IDs and listen for channel creation.

Each device/app install will generate a unique identifier known as the Channel ID. Once a Channel ID is created, it will persist in the application until the app is reinstalled, or has its internal data is cleared.

For information about finding Channel IDs, using the Channel Capture tool, and other methods to access Channel IDs, see Finding Channel IDs.

Accessing the Airship Channel ID

Apps can access the Channel ID directly through the SDK.

// Get the channel ID (may return null if not yet created)
const channelId = await Airship.channel.getChannelId();

// Wait for the channel ID to be created (returns the channel ID once available)
const channelId = await Airship.channel.waitForChannelId();

The Channel ID is asynchronously created, so it may not be available right away on the first run. Use waitForChannelId() if you need to wait for the channel to be created before proceeding. Changes to Channel data will automatically be batched and applied when the Channel is created, so there is no need to wait for the Channel to be available before modifying any data.

Applications that need to access the Channel ID can use a listener to be notified when it is available.

Airship.addListener(EventType.ChannelCreated, (event) => {
    console.log('Channel created: ', event.channelId);
});

Channel Capture tool

The Channel Capture tool is a feature built into the SDK that helps users find their Channel ID. For detailed information about how it works and how to use it, see Finding Channel IDs.

The Channel Capture tool can be disabled through the Airship Config options passed to takeOff during SDK initialization. For information about setting up the Airship SDK and configuring the takeOff options, see React Native SDK Setup.

await Airship.takeoff({
    ...
    isChannelCaptureEnabled: false,
})

Delaying channel creation

Airship creates the channel if at least one feature is enabled in the Privacy Manager. To delay channel creation, use the Privacy Manager to disable all features during takeOff.

For more information about Privacy Manager, see SDK Data Collection.