Links

Getting started

Prerequisites

  • Firework App Id
  • React Native 0.60 or greater.
  • iOS project
    • iOS 12 or greater.
    • Xcode 13 or greater.
    • Swift 5.5 or greater.
  • Android Project
    • JAVA_HOME 1.8 or greater
    • minSdkVersion 21 or greater
    • compileSdkVersion 31 or greater
    • targetSdkVersion = 31 or greater
    • kotlin_version 1.6.10

Installation

Installing Firework React Native SDK requires the following step:
  1. 1.
    Install NPM package
  2. 2.
    Setup Native project

Install NPM Package

npm install [email protected]
#or

Setup Native Project

iOS

Run pod install in the root directory of the iOS project. And we also need to re-run pod install when upgrading the RN SDK version.

Android

  • build.gradle
buildscript {
repositories {
...
mavenCentral()
}
dependencies {
// We don’t require the Gradle plugin version. But we suggest using 4.2+.
classpath("com.android.tools.build:gradle:4.2.0")
...
}
}
allprojects {
repositories {
...
mavenCentral()
}
}
  • gradle-wrapper.properties
...
# We don’t require the Gradle version. But we suggest using 6+.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
...
  • app/build.gradle
...
apply from: 'firework.gradle'
  • New file: app/firework.gradle
android {
packagingOptions {
exclude 'META-INF/annotation.kotlin_module'
exclude 'META-INF/lifecycle-viewmodel_release.kotlin_module'
exclude 'META-INF/annotation-experimental_release.kotlin_module'
exclude 'META-INF/kotlin-stdlib.kotlin_module'
}
}

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:
<application
...
>
<activity .../>
...
// Include the app ID
<meta-data
android:name="Firework:Appid"
android:value="your firework appid" />
</application>

SDK Initialization

import FireworkSDK from 'react-native-firework-sdk';
/*
Optional: set listener for SDK init
*/
FireworkSDK.getInstance().onSDKInit = (event) => {
console.log('onSDKInit', event);
};
/*
It is recommended to call the init method when the application starts,
e.g. in the App.tsx.
The init method supports passing options parameters.
The options type is SDKInitOptions.
*/
FireworkSDK.getInstance().init();

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.

Sample Project

We provide a sample project on Github.