# Finding Channel IDs

{{< glossary_definition "channel_id" >}}

Follow these methods to find the [Channel ID](https://www.airship.com/docs/reference/glossary/#channel_id) 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:


#### iOS Swift


```swift
let channelID = Airship.channel.identifier
```



#### iOS Objective-C


```objc
NSString *channelID = UAirship.channel.identifier;
```



#### Android Kotlin


```kotlin
val channelId = Airship.channel.id
```



#### Android Java


```java
String channelId = Airship.getChannel().getId();
```



#### React Native


```ts
const channelId = await Airship.channel.getChannelId();
```



#### Flutter


```dart
String channelId = await Airship.channel.identifier;
```



#### Cordova


```js
Airship.channel.getChannelId((channelID) => {
    console.log("Channel: " + channelID)
})
```



#### Capacitor


```js
const channelID = await Airship.channel.getChannelId()
```



#### .NET MAUI


```csharp
using AirshipDotNet;

string channelId = Airship.Instance.ChannelId;
```



#### Unity


```csharp
string channelId = UAirship.Shared.ChannelId;
```




For more detailed information about accessing channel IDs, see the platform-specific documentation:
* [iOS Audience Management](https://www.airship.com/docs/developer/sdk-integration/apple/audience/channels/)
* [Android Audience Management](https://www.airship.com/docs/developer/sdk-integration/android/audience/channels/)
* [React Native Audience Management](https://www.airship.com/docs/developer/sdk-integration/react-native/audience/channels/)
* [Flutter Audience Management](https://www.airship.com/docs/developer/sdk-integration/flutter/audience/channels/)
* [Cordova Audience Management](https://www.airship.com/docs/developer/sdk-integration/cordova/audience/channels/)
* [Capacitor Audience Management](https://www.airship.com/docs/developer/sdk-integration/capacitor/audience/channels/)
* [.NET Audience Management](https://www.airship.com/docs/developer/sdk-integration/dotnet/audience/channels/)
* [Unity Audience Management](https://www.airship.com/docs/developer/sdk-integration/unity/audience/channels/)

### 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 Group](https://www.airship.com/docs/reference/glossary/#preview_test_groups).

<div class="u-xl-size-3of5" style="margin: 0 auto" >
[Channel Capture](https://airship.wistia.com/medias/w5v083w2oj)

</div>

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.


#### Android Kotlin


```kotlin
val options = AirshipConfigOptions.newBuilder()
    // ...
    .setChannelCaptureEnabled(false)
    .build()
```



#### Android Java


```java
AirshipConfigOptions options = AirshipConfigOptions.newBuilder()
    // ...
    .setChannelCaptureEnabled(false)
    .build();
```



#### iOS Swift


```swift
config.isChannelCaptureEnabled = false
```



#### iOS Objective-C


```objc
config.isChannelCaptureEnabled = NO;
```



#### React Native


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



#### Flutter


```dart
Airship.takeOff(
    AirshipConfig(
      ...
      isChannelCaptureEnabled: false
    )
  );
```



#### Cordova


```js
Airship.takeoff({
    ...
    isChannelCaptureEnabled: false,
})
```



#### Capacitor


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



#### .NET MAUI


```csharp
// Not supported
```



#### Xamarin


```csharp
// Not supported
```



#### Titanium


```js
// Not supported
```



#### Unity


```csharp
// 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:

* **iOS:** [iPhone Configuration Utility](https://support.apple.com/downloads/iphone_configuration_utility) or [Xcode](https://developer.apple.com/xcode/)
* **Android:** [Android Debug Bridge](https://developer.android.com/tools/adb)

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](https://support.airship.com/hc/en-us/articles/213491123-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](https://www.airship.com/docs/developer/sdk-integration/web/getting-started/) 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.

1. 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**

   ```javascript
UA.then(sdk => {console.log(sdk.channel.id)})
```


   ![The Channel ID in a successful console response](https://www.airship.com/docs/images/channel_id_console_response_hu_60bcff090b24cb03.webp)

*The Channel ID in a successful console response*



   **Version 2 (asynchronous call)**

   ```javascript
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:**

* ![Response: null](https://www.airship.com/docs/images/channel_id_console_null_hu_1ae99c08456231dd.webp)

*Response: null*

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](https://www.airship.com/docs/developer/sdk-integration/web/getting-started/#uasdk).

* ![Response: UA is not defined](https://www.airship.com/docs/images/channel_id_console_no_sdk_hu_d5edbddbbc20e773.webp)

*Response: UA is not defined*

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](https://www.airship.com/docs/developer/sdk-integration/web/getting-started/#add-javascript-snippet-to-web-pages) 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.
