Getting Started (React Native)

Latest version release notes

Prerequisites

  • Firework App Id

  • React Native 0.60 or greater.

  • iOS project

    • iOS 13 or greater.

    • Xcode 14 or greater.

    • Swift 5.7 or greater.

  • Android Project

    • JAVA_HOME 1.8 or greater

    • minSdkVersion 21 or greater

    • compileSdkVersion 31 or greater

    • targetSdkVersion = 31 or greater

    • kotlinVersion 1.8.0 or greater

Installation

Installing Firework React Native SDK requires the following step:

  1. Install NPM package

  2. Setup Native project

Install NPM Package

Setup Native Project

iOS

Run pod install in the root directory of the iOS project. And if you encountered the following issues, you could run pod update FireworkVideo FireworkVideoUI.

  1. CocoaPods could not find compatible versions for pod "FireworkVideo"

  2. CocoaPods could not find compatible versions for pod "FireworkVideoUI"

Android

  • build.gradle

If you have integrated our SDK version v2.17.0 or later, please use Gradle plugin version 8.0.2 or higher.

If your current React Native version is below 0.71, please add the following configuration in Gradle to use the Android dependencies of older React Native versions.

  • gradle-wrapper.properties

If you have integrated our SDK version v2.17.0 or later, please use Gradle version 8.0 or higher.

  • app/build.gradle

  • add android:windowSoftInputMode="adjustPan" to the file app/src/Androidmanifest.xml if there is a story block in your app and use the live stream

  • New file: app/firework.gradle

App Id Configuration

iOS

Include the app ID in your app Info.plist file using the key FireworkVideoAppID .

See the image below:

Android

Include the appid in your app AndroidManifest.xml file, like below:

SDK Initialization

iOS

In your iOS project, you need to call FWReactNativeSDK.initializeSDK(nil) in application(:, didFinishLaunchingWithOptions:) -> Bool method.

If your AppDelegate class is written by Objective-C, you should create a Swift file to call the API. For example, you could create FireworkSupportLibraryBridge.swift and add the following codes.

Then add [FireworkSupportLibraryBridge initFireworkSDK]; on application:didFinishLaunchingWithOptions: method.

iOS initialization options

We support passing an option to the SDK initialization method. The sample codes are:

The SDK init option structure is:

Android

Step 1: Add the FWReactNative.init method to your MainApplication class.

Android initialization options

We support passing an option to the SDK initialization method. The sample codes are:

The SDK init option structure is:

Step 2: Please check the Inject Image Loader section. Choose an image loader(Glide or Picasso) that works for you. If you're not sure which one to use, Glide image loader is recommended.

JS

Call FireworkSDK.getInstance().markInitCalled() on the JS side.

Next

ATT compliance

To ensure compliance with Apple privacy guidelines and regulations, we don't track data if users don't allow it. Please refer to ATT compliance React Native (iOS).

Video Feed

If you want to integrate a video feed, please follow the instruction here.

Shopping

If you want to integrate video shopping, please follow the instruction here.

Livestream support

Enable low latency live stream

Please refer to the following links:

Use modern (v2) livestream player

Please follow the instruction here.

Sample Project

We provide a sample project on Github.

Last updated

Was this helpful?