# Install and Set Up the Capacitor Plugin

How to install the Airship Capacitor plugin.
## Requirements

- Capacitor 5.0.0 or higher
- iOS 15+ (Xcode 16+)
- Android API 23+

## Setup

Install the plugin

```bash
npm install @ua/capacitor-airship
npx cap sync
```


## Initialize Airship

Before you can access any of the module's API, the Airship module needs to be initialized. 

This can be accomplished by calling `takeOff` when the device is ready with the proper config or by providing plugin config in the `capacitor.config.json` file.

**Calling takeOff**


```typescript
// TakeOff
await Airship.takeOff({
  production: {
    appKey: "<APP_KEY>",
    appSecret: "<APP_SECRET>"
  },
  development: {
    appKey: "<APP_KEY>",
    appSecret: "<APP_SECRET>"
  },
  inProduction: true, 
  site: "us", // use "eu" for EU cloud projects
  urlAllowList: ["*"],
  android: {
      notificationConfig: {
          icon: "ic_notification",
          accentColor: "#00ff00"
      }
  }
})
```


**Using capacitor.config.json**


```json
{
   "appId":"com.example.plugin",
   "appName":"example",
   "bundledWebRuntime":false,
   "webDir":"dist",
   "plugins":{
      "SplashScreen":{
         "launchShowDuration":0
      },
      "Airship":{
         "config":{
            "default":{
               "appKey":"<APP_KEY>",
               "appSecret":"<APP_SECRET>"
            },
            "site":"us",
            "urlAllowList":[
               "*"
            ],
            "android":{
               "notificationConfig":{
                  "icon":"ic_notification",
                  "accentColor":"#00ff00"
               }
            }
         }
      }
   },
   "server":{
      "androidScheme":"https"
   }
}
}
```


Takeoff can be called multiple times, but the config passed in `takeOff` won't be applied until the next app init.

For a complete list of configuration options, see the [AirshipConfig reference](https://www.airship.com/docs/reference/libraries/capacitor-airship/latest/interfaces/AirshipConfig.html).

## Test the integration

After completing the setup, verify your integration:

1. **Build and run your app** on your iOS or Android device/simulator/emulator.
2. **Check the console output** for Airship channel creation:
   - **iOS**: Look for a log message in Xcode console: `Channel ID: <CHANNEL_ID>`
   - **Android**: Look for a log message in logcat: `Airship channel created: <CHANNEL_ID>`
   - The channel ID confirms successful SDK initialization.
   - For more detailed logging, see [Logging](https://www.airship.com/docs/developer/sdk-integration/capacitor/installation/logging/).

If you see the channel ID in the console and no errors, your integration is successful.

## Next steps

- [Advanced Configuration](https://www.airship.com/docs/developer/sdk-integration/capacitor/installation/advanced-configuration/): Configure URL allowlists and other advanced settings
- [Extending Airship](https://www.airship.com/docs/developer/sdk-integration/capacitor/installation/extending-airship/): Access native SDK features for advanced customization
- [Push Notifications](https://www.airship.com/docs/developer/sdk-integration/capacitor/push-notifications/getting-started/): Configure push notifications
- [Deep Links](https://www.airship.com/docs/developer/sdk-integration/capacitor/deep-links/): Handle deep links in your app

If you don't see a channel ID or encounter errors during initialization, see [Troubleshooting Initialization](https://www.airship.com/docs/developer/sdk-integration/capacitor/troubleshooting/initialization/) for common problems and solutions.

