Getting Started
This is a developers’ guide for setting up the Airship SDK for Titanium apps.
The Airship Titanium module allows a developer to integrate push notification services with Titanium apps targeting both Android and iOS. This plugin is designed to be cross-platform, and applications making use of it can leverage the same code on both platforms.
Resources
Requirements
- Titanium 10.0.0+
- To use notifications:
iOS
- Xcode
13+
- minimum deployment target iOS
11+
Android
- minSdkVersion
21+
- compileSdkVersion
31+
Setup
Start by downloading
the latest iOS and Android modules. Modify the tiapp.xml
file to include and
configure the Airship module.
Configure Airship
var Airship = require("ti.airship");
Airship.takeOff({
development: {
appKey: Your Development App Key,
appSecret: Your Development App Secret
},
production: {
appKey: Your Production App Key,
appSecret: Your Production App Secret
},
site: "us" // use `eu` for EU sites.
urlAllowList: ["*"] // allows all URLs
android: {
notificationConfig: {
icon: "ic_notification",
accentColor: "#ff0000"
}
}
});
<ti:app>
...
<modules>
...
<module platform="android">ti.airship</module>
<module platform="iphone">ti.airship</module>
</modules>
<ios>
<plist>
<dict>
...
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
</dict>
</plist>
</ios>
</ti:app>
Android FCM
Android requires the google-services.json
file to be copied into the app’s directory platform/android/google-services.json
.
Send Your First Push Notification
At this point in the guide, if you followed all the steps above you should be ready to send a test push notification to verify everything is set up properly.
Before sending a push, you must enable user notifications. The module does not enable user notifications by default in order to avoid prompting the user for permissions. But for a testing purposes, you can enable user notifications as soon as the application is ready. You may also want to set default foreground presentation options to display the notification in the foreground on iOS 10. On older iOS devices, make sure you background the app before sending the push.
var Airship = require('ti.airship')
Airship.push.userNotificationsEnabled = true
Categories