by natasa | v5.0.0
Urban Airship plugin for NativeScript.
npm i --save nativescript-urban-airship

NativeScript plugin for Urban Airship

npm version

This is a plugin to use the Urban Airship SDK (Android v14.4.0, iOS v14.4.1) with NativeScript.
For iOS this plugin uses APNS and for Android it uses FCM.


  • Xcode 12.x
  • Android SDK 29
  • NativeScript CLI 7.x
  • Urban Airship account


Run the following command from the root of your project:

npm install nativescript-urban-airship


First create a file with all your Urban Airship setting (example).


  1. Create a custom native in your app folder (example) that calls startUp() with your settings in the onCreate():

    public onCreate(): void {

    NsUrbanAirship.getInstance().startUp(urbanAirshipSettings, this);

    Use that custom application in the application tag in your AndroidManifest.xml (example).

  2. Place your google-services.json in your App_Resources/Android folder. This json file can be created using the setup of FCM.

  3. Copy the hooks firebase-adjust-gradle.js and firebase-copy-google-services.js from our demo app to the after-prepare folder of your app.

  4. Specify the right applicationId in your app's app.gradle (example).

  5. Specify the right id in your app's package.json.


Create a custom UIApplicationDelegate in your app folder (example) that calls startUp() with your settings in the applicationDidFinishLaunchingWithOptions():

applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<string, any>): boolean {
NsUrbanAirship.getInstance().startUp(urbanAirshipSettings, null);
return true;

Import that custom UIApplicationDelegate in your app.ts (example).

Known Issues

When using webpack, calling startUp() on Android in a custom native is not working, in that case it is better to call the native function instead of startUp():

public onCreate(): void {

const options = new com.urbanairship.AirshipConfigOptions.Builder()

com.urbanairship.UAirship.takeOff(this, options);

Optional functions

Setting Named User Id

To register a named user id call registerUser().


Removing Named User Id

To remove a named user id call unRegisterUser().


Enabling User Notifications

To set user notifications to enabled call notificationOptIn().


Disabling User Notifications

To set user notifications to disabled call notificationOptOut().


Getting Enabled User Notifications

To get the status of enabled push notifications call isOptIn(), this will return true or false.


Getting Channel ID

To get the channel ID call getChannelID(), this will return a string.


Getting Registration Token

To get the registration token (APNS token for iOS and FCM token for Android) call getRegistrationToken(), this will return a string.


Resetting Badge Count (iOS only)

To reset the badge count call resetBadgeCount().