Finding Channel IDs

A Channel ID is an Airship-specific unique identifier for a channel instance, e.g., a smartphone, web browser, email address.

Follow these methods to find the Channel IDAn Airship-specific unique identifier used to address a channel instance, e.g., a smartphone, web browser, email address. in a mobile app or web browser.

Find a mobile app Channel ID

You can find a device’s Channel ID by accessing it programmatically in your app or using the Channel Capture tool.

Accessing the Channel ID programmatically

You can access the Channel ID directly through the SDK in your app code:

Accessing the channel ID

let channelID = Airship.channel.identifier
NSString *channelID = UAirship.channel.identifier;
val channelId = Airship.channel.id
String channelId = Airship.getChannel().getId();
const channelId = await Airship.channel.getChannelId();
String channelId = await Airship.channel.identifier;
Airship.channel.getChannelId((channelID) => {
    console.log("Channel: " + channelID)
})
const channelID = await Airship.channel.getChannelId()
using AirshipDotNet;

string channelId = Airship.Instance.ChannelId;
string channelId = UAirship.Shared.ChannelId;

For more detailed information about accessing channel IDs, see the platform-specific documentation:

Using the Channel Capture tool

The Channel Capture tool is a feature built into the SDK that helps users find their Channel ID. It is valuable for troubleshooting individual device issues in production apps since it can expose the Channel ID to the user, who can then send it to Support. Users can also use it to find their Channel ID for a Preview or Test GroupA preview group is audience group used for previewing personalized content in the dashboard. Wherever a personalization preview is available, you can select a preview group, and its group members’ attributes will appear for any Handlebars references to attributes. You can enable any preview group as a test group so you can send test messages to its group members. These messages appear as tests in Messages Overview..

If the Channel Capture tool is enabled, it will listen for six app foregrounds within 30 seconds. On the sixth app open, the Channel ID will be copied to the user’s clipboard with a leading ua:. Paste your Channel ID from the clipboard to your preferred document. If there is no channel, only ua: will be present. The Channel ID will remain on the clipboard for 60 seconds on iOS and until cleared on Android.

The Channel Capture tool is enabled by default and can be disabled through the Airship Config options. For information on how to disable it, see the platform-specific documentation linked above.

Disabling Channel Capture tool

val options = AirshipConfigOptions.newBuilder()
    // ...
    .setChannelCaptureEnabled(false)
    .build()
AirshipConfigOptions options = AirshipConfigOptions.newBuilder()
    // ...
    .setChannelCaptureEnabled(false)
    .build();
config.isChannelCaptureEnabled = false
config.isChannelCaptureEnabled = NO;
await Airship.takeoff({
    ...
    isChannelCaptureEnabled: false,
})
  Airship.takeOff(
    AirshipConfig(
      ...
      isChannelCaptureEnabled: false
    )
  );
Airship.takeoff({
    ...
    isChannelCaptureEnabled: false,
})
await Airship.takeoff({
    ...
    isChannelCaptureEnabled: false,
})
// Not supported
// Not supported
// Not supported
// Not supported

Alternative methods

You can also find a device’s Channel ID by logging it to the console. You can view the console with these tools:

If you didn’t write the device identifier to the console, you can use the steps here to help retrieve it: Using Charles Proxy to profile an Airship Implementation.

 Tip

Even if you’re comfortable with using Charles Proxy, you may want to speak with your developer before you attempt to retrieve your Channel ID yourself. Your app may have been designed with a hidden feature that allows you to quickly retrieve your ID, saving you the difficulty of working with Charles Proxy.

Find a web browser Channel ID

Your web Channel ID is only available if you have already integrated the Airship SDK with your website. To access your web Channel ID, you will need to open the Developer console in your browser and paste in a small amount of code. Instructions for Google Chrome and Mozilla Firefox are provided.

  1. Open the console via keyboard shortcut or the menu.

    Google Chrome

    • Keyboard Shortcuts: In macOS you can go directly to the console with Cmd+Opt+J. In Windows, the shortcut is Ctrl+Shift+J.
    • Menu: Select the three dots icon (), then More Tools, then Developer Tools, then select the Console tab.

    Mozilla Firefox

    • Keyboard Shortcuts: In macOS you can go directly to the console with Cmd+Opt+K. In Windows, the shortcut is Ctrl+Shift+K.
    • Menu: Select the “hamburger” icon, then More Tools, then Web Developer Tools, and then select the Console tab.
  2. Depending on the web SDK version, paste the following code in the console, then hit Enter. If a browser has registered, the resulting line is the Channel ID.

    Version 1
    UA.then(sdk => {console.log(sdk.channel.id)})

    Version 2 (asynchronous call)
    UA.then(sdk=>console.log(sdk.channel.id().then((channel)=>console.log(channel))))
    
    // Or if you are using async/await syntax
    
    (async function getChannel() {
    const sdk = await UA;
    const channelId = await sdk.channel.id();
    console.log(channelId);
    })();

Common errors:

  • The SDK will return null if the browser is unregistered. Only registered browsers will have a Channel ID. See our documentation on how to register the current browser with Airship.

  • A UA is not defined response can indicate that the SDK snippet is not present within the page. Navigate to a page on your site that does have the SDK snippet and repeat step 2 above.

     Note

    Ideally, the SDK snippet will be present in every page on your site, as per the Add JavaScript Snippet section of our Web Getting Started guide. If, for testing or other reasons, you have added the snippet to just one page of your site, you will need to be on that specific page for retrieving your Web Channel ID to be successful.