14.7.0 • Published 9 months ago

urbanairship-react-native v14.7.0

Weekly downloads
4,912
License
Apache-2.0
Repository
github
Last release
9 months ago

Airship React Native

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

Resources

Issues

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

Requirements:

  • Xcode 11+
  • iOS: Deployment target 11.0+
  • Android: minSdkVersion 16+, compileSdkVersion 28+
  • React Native >= 0.60.0
  • React Native cli >= 2.0.1

Install

# using yarn
yarn add urbanairship-react-native

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

iOS Setup

1) Install pods

cd ios && pod install

2) Add the following capabilities for your application target:

  • Push Notification
  • Background Modes > Remote Notifications

3) 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">
<dict>
  <key>developmentAppKey</key>
  <string>Your Development App Key</string>
  <key>developmentAppSecret</key>
  <string>Your Development App Secret</string>
  <key>productionAppKey</key>
  <string>Your Production App Key</string>
  <key>productionAppSecret</key>
  <string>Your Production App Secret</string>
</dict>
</plist>

4) 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) 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 {
        jcenter()
        google()
    }
    dependencies {
        ...
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

2) 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'

3) Download your google-services.json file. This can be accomplished by following google-services.json help documentation:

4) 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 17.0.0+
    firebaseCoreVersion "VERSION"

    // Requires 19.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 {
  UrbanAirship,
  UACustomEvent,
} from 'urbanairship-react-native'

...

export default class Sample extends Component {

  constructor(props) {
    super(props);
    UrbanAirship.setUserNotificationsEnabled(true);
  }

  ...
}
14.7.0

9 months ago

14.6.1

1 year ago

14.5.0

1 year ago

14.5.1

1 year ago

14.6.0

1 year ago

14.4.2

2 years ago

14.4.3

2 years ago

14.4.4

2 years ago

14.3.1

2 years ago

14.4.0

2 years ago

14.4.1

2 years ago

14.3.0

2 years ago

14.2.1

2 years ago

14.1.0

2 years ago

14.0.0

2 years ago

14.2.0

2 years ago

13.1.1

2 years ago

13.1.0

2 years ago

13.2.0

2 years ago

13.2.1

2 years ago

13.0.2

2 years ago

13.0.1

2 years ago

13.0.0

3 years ago

12.1.0

3 years ago

12.0.0

3 years ago

11.0.2

3 years ago

11.0.1

3 years ago

11.0.0

3 years ago

10.0.2

3 years ago

10.0.1

3 years ago

10.0.0

3 years ago

9.0.1

4 years ago

9.0.0

4 years ago

8.1.0

4 years ago

8.0.1

4 years ago

8.0.0

4 years ago

7.0.0

4 years ago

6.1.3

4 years ago

6.1.2

4 years ago

6.1.1

4 years ago

6.1.0

4 years ago

6.0.1

4 years ago

6.0.0

4 years ago

5.0.1

4 years ago

5.0.0

5 years ago

3.2.2

5 years ago

4.0.1

5 years ago

3.2.1

5 years ago

4.0.0

5 years ago

3.2.0

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.0.3

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago