Channels
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.
string channelId = Airship.Shared.channel.GetChannelId();The channel ID is asynchronously created, so it may not be available right away on the first run. 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 the channel ID as soon as it exists can wait for it with the WaitForChannelId coroutine, which completes once the channel ID is available.
StartCoroutine(Airship.Shared.channel.WaitForChannelId((string channelId) => {
Debug.Log("Channel ID: " + channelId);
}));You can also listen for channel creation with the OnChannelCreated event.
Airship.Shared.OnChannelCreated += (string channelId) => {
Debug.Log("Channel created: " + channelId);
};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.
using AirshipSDK;
Airship.Shared.TakeOff(new AirshipConfig() {
@default = new ConfigEnvironment() {
appKey = "<APP_KEY>",
appSecret = "<APP_SECRET>",
},
enabledFeatures = new string[] { },
});Enable features later with the Privacy Manager to create the channel. For more information, see Privacy Manager and SDK Data Collection.