Airship HMS module for React Native apps.

react, react-native, react-component, android, airship, accengage, hms, huawei mobile services
npm install urbanairship-hms-react-native@14.3.1


Airship React Native

A React Native module for Airship's iOS and Android SDK.



Please visit https://support.airship.com/ for any issues integrating or using this module.


  • Xcode 13+
  • iOS: Deployment target 11.0+
  • Android: minSdkVersion 21+, compileSdkVersion 31+
  • Gradle Plugin to version 3.0.0 or higher
  • Java 8
  • React Native >= 0.60.0
  • React Native cli >= 2.0.1


# using yarn
yarn add urbanairship-react-native

# using npm
npm install urbanairship-react-native --save

iOS Setup

  1. Install pods
cd ios && pod install
  1. Add the following capabilities for your application target:
  • Push Notification
  • Background Modes > Remote Notifications
  1. Create a plist AirshipConfig.plist and include it in your application’s target:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <string>Your Development App Key</string>
  <string>Your Development App Secret</string>
  <string>Your Production App Key</string>
  <string>Your Production App Secret</string>
  1. Optional. In order to take advantage of iOS 10 notification attachments, such as images, animated gifs, and video, you will need to create a notification service extension by following the iOS Notification Service Extension Guide

Android Setup

  1. Compile and Target SDK Versions:

Urban Airship now requires compileSdk version 31 (Android 12) or higher.

Please update the build.gradle file:

android {
    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 31

        // ...
  1. Java 8 Source Compatibility:

Urban Airship now requires Java 8 language features across all SDK modules.

Please update Android Gradle Plugin to version 3.0.0 or higher and change the source and target compatibility for each module that uses Airship SDKs:

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

Modules using Kotlin will also need to set the target version of the generated JVM bytecode:

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach  {
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
  1. Create the airshipconfig.properties file in the application's app/src/main/assets:
developmentAppKey = Your Development App Key
developmentAppSecret = Your Development App Secret

productionAppKey = Your Production App Key
productionAppSecret = Your Production Secret

# Notification customization
notificationIcon = ic_notification
notificationAccentColor = #ff0000

Android FCM Setup

Adding FCM to your react-native project can be accomplished with the following steps:

  1. Add the google-services gradle plugin dependency to the build.gradle file in project root directory:
buildscript {
    repositories {
    dependencies {
        classpath 'com.google.gms:google-services:4.2.0'
  1. Apply the google-services plugin at the end of the build.gradle file in the app/ directory. The plugin directive specifically needs to be included at the end of the build.gradle file to prevent potential dependency collisions. For more information, see the plugin documentation.
apply plugin: 'com.google.gms.google-services'
  1. Download your google-services.json file. This can be accomplished by following google-services.json help documentation:

  2. Add the downloaded google-service.json file to the app/ directory of your project. For more information on adding the configuration file please see the google services plugin guide

Overriding Firebase Dependency Versions

Firebase core and messaging dependencies versions can be overriden by setting the firebaseCoreVersion and firebaseMessagingVersion in the project's build.gradle file:

ext {
    // Requires 21.0.0+
    firebaseMessagingVersion "VERSION"

Enabling Notifications

Notifications by default are disabled to avoid prompting the user for permissions at an inopportune time. For testing purposes, you probably want to enable Notifications immediately to verify push is working:

Note: Push notifications are not supported on iOS simulators.

import {
} from 'urbanairship-react-native'


export default class Sample extends Component {

  constructor(props) {