# Extend Airship

How to extend the Airship Unity plugin to access native iOS and Android SDK features not exposed through the Unity API.

You can provide a plugin extender that is automatically loaded for the app. The extender can modify the Airship config before SDK initialization and access the underlying native SDK once Airship is ready. This gives the app a chance to customize parts of Airship that are not configurable through the Unity plugin, such as setting up [iOS Live Activities](https://www.airship.com/docs/developer/sdk-integration/unity/live-activities/) and [Android Live Updates](https://www.airship.com/docs/developer/sdk-integration/unity/live-updates/).

Because Unity generates the native iOS and Android projects, add these files to the exported projects and reapply them, or script them as a post-build step, whenever a project is regenerated on a clean build.

## iOS

Create a Swift file named `AirshipPluginExtender.swift` in the exported Xcode project and include it in the main app target. The class must have the `@objc(AirshipPluginExtender)` annotation and conform to `AirshipPluginExtenderProtocol`.

```swift
import Foundation
import AirshipKit
import AirshipFrameworkProxy
import ActivityKit

@objc(AirshipPluginExtender)
public class AirshipPluginExtender: NSObject, AirshipPluginExtenderProtocol {

  public static func onAirshipReady() {
   // Called when Airship is ready on the MainActor
  }

  public static func extendConfig(config: inout AirshipConfig) {
   // Called to extend the AirshipConfig before SDK initialization
  }

}
```


## Android

Create a class named `AirshipExtender` in your app's source directory. It must implement `com.urbanairship.android.framework.proxy.AirshipPluginExtender` and have an empty constructor.

```kotlin
// Replace with your package
package com.example

import android.content.Context
import androidx.annotation.Keep
import com.urbanairship.AirshipConfigOptions
import com.urbanairship.android.framework.proxy.AirshipPluginExtender

@Keep
public final class AirshipExtender: AirshipPluginExtender {

    override fun onAirshipReady(context: Context) {
        // Called when Airship is ready on a background thread.
        // Avoid doing long running, blocking work or it will delay Airship
    }

    override fun extendConfig(
        context: Context,
        configBuilder: AirshipConfigOptions.Builder
    ): AirshipConfigOptions.Builder {
        // Called to extend the AirshipConfig before SDK initialization
        return configBuilder
    }

}
```


Register the extender in the Android manifest. In Unity, add this entry to a Custom Main Manifest so it is not erased when the project is regenerated:

```xml
<application ...>

    <meta-data android:name="com.urbanairship.plugin.extender"
        android:value="com.example.AirshipExtender" />

    <!-- ... -->
</application>
```

