Cordova Plugin Setup
How to install the Airship Cordova plugin.
Requirements
- cordova >= 10.0.0
- cordova-ios >= 6.1.0
- cordova-android >= 9.0.0
- cococapods >= 1.9
iOS
- Requires Xcode
13+
- Minimum iOS version supported
11+
- To use notifications:
iOS only: Add your Apple Developer Account Team ID to the build.json .
{
"ios": {
"debug": {
"developmentTeam": "XXXXXXXXXX"
},
"release": {
"developmentTeam": "XXXXXXXXXX"
}
}
}
Your iOS builds will need to reference the build.json
using Cordova’s --buildConfig
flag.
Android
- Minimum Android version supported
21+
- Compile SDK version and Target SDK version
31+
- Gradle Plugin version 3.0.0+
- Java 8
- To use notifications:
Android only: Add a reference to your google-services.json
file in the app’s config.xml
<platform name="android">
...
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
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.
Calling takeOff
// TakeOff
UAirship.takeOff({
production: {
appKey: "<APP_KEY>",
appSecret: "<APP_SECRET>"
},
development: {
appKey: "<APP_KEY>",
appSecret: "<APP_SECRET>"
},
site: "EU" // Optional. Either "EU" or "US". Defaults to "US".
})
// Configure Android
UAirship.setAndroidNotificationConfig({
icon: "ic_notification",
largeIcon: "ic_notification_large",
accentColor: "#FF0000"
})
// Configure iOS
UAirship.setPresentationOptions(
UAirship.presentationOptions.sound | UAirship.presentationOptions.alert
)
Takeoff can be called multiple times, but the config passed in takeOff
won’t be applied until the next app init.
iOS Notification Service Extension
To take advantage of notification attachments, such as images, animated gifs, and video, you will need to create a notification service extension .
Follow the steps in the iOS Notification Service Extension Guide.Feedback
Was this page helpful?
Thank you
Thanks for your feedback!
Tell Us MoreThank you
We will try harder!
Tell Us MoreCategories