Advanced Configuration

Configure advanced settings like URL allowlists and other options for the Airship Unity plugin.

View as Markdown

You can configure Airship at runtime by passing an AirshipConfig to TakeOff early in your app lifecycle. This is an alternative to the editor Settings window described in Install and Set Up the Unity Plugin.

using AirshipSDK;

Airship.Shared.TakeOff(new AirshipConfig() {
    // Applied when neither development nor production overrides it
    @default = new ConfigEnvironment() {
        appKey = "<APP_KEY>",
        appSecret = "<APP_SECRET>",
        logLevel = LogLevel.Verbose,
    },
    // Optional per-environment overrides
    development = new ConfigEnvironment() {
        appKey = "<DEV_APP_KEY>",
        appSecret = "<DEV_APP_SECRET>",
    },
    production = new ConfigEnvironment() {
        appKey = "<PROD_APP_KEY>",
        appSecret = "<PROD_APP_SECRET>",
    },
    site = Site.US, // use Site.EU for EU cloud projects
    inProduction = false,
    urlAllowList = new string[] { "*" },
    enabledFeatures = new string[] { "all" },
});

Environments

The @default environment is used unless it is overridden by the development or production environment. Airship selects the development environment when inProduction is false and the production environment when inProduction is true. If inProduction is not set, Airship determines the value at runtime.

Cloud site

Set site to Site.EU if your project uses Airship’s EU cloud site. The default is Site.US.

URL Allowlist

The URL allowlist controls which URLs the Airship SDK is able to act on. Configure the allowlist using the following properties:

  • urlAllowListScopeOpenUrl: Only URLs allowed for this scope can be opened from an action, displayed in a landing page, displayed in an HTML in-app message, or displayed as media in an In-App Automation. Defaults to any Airship-originated URLs and YouTube URLs.
  • urlAllowListScopeJavaScriptInterface: These URLs are checked before the Airship JavaScript interface is injected into the webview. Defaults to any Airship-originated URLs.
  • urlAllowList: Both scopes are applied to these URLs.
Airship.Shared.TakeOff(new AirshipConfig() {
    @default = new ConfigEnvironment() {
        appKey = "<APP_KEY>",
        appSecret = "<APP_SECRET>",
    },
    urlAllowList = new string[] { "*" }, // Accept all URLs
    // Or configure specific scopes:
    urlAllowListScopeOpenUrl = new string[] { "https://example.com/*", "https://*.youtube.com/*" },
    urlAllowListScopeJavaScriptInterface = new string[] { "https://example.com/*" },
});
Valid URL pattern syntax
<pattern> := '*' | <scheme>'://'<host>/<path> | <scheme>'://'<host> | <scheme>':/'<path> | <scheme>':///'<path>
<scheme> := <any char combination, '*' are treated as wild cards>
<host> := '*' | '*.'<any char combination except '/' and '*'> | <any char combination except '/' and '*'>
<path> := <any char combination, '*' are treated as wild cards>

To accept any URL within the SDK, set the urlAllowList to new string[] { "*" }.

Additional options

  • enabledFeatures: The features enabled at launch. Defaults to all features. See Privacy Manager.
  • autoPauseInAppAutomationOnLaunch: Pauses In-App Automation on launch. See Get started with In-App Experiences.
  • initialConfigUrl: The initial config URL for custom Airship domains. The URL should also be added to the urlAllowList.
  • ios: An IOSConfig for iOS-specific options, such as itunesId.
  • android: An AndroidConfig for Android-specific options, such as the app store URI, FCM app name, and notification defaults.