Getting Started with Android SDK

About

The Firework Android SDK is a library offering various programming interfaces for developers to embed video feeds from Firework, a platform specializing in shoppable videos and livestreams, into an Android application.

Requirements

Live2.ai is compatible with the following:

  • Android min SDK 21

  • Kotlin/Java code base

  • Gradle build system

Retrieve your Auth Token

To integrate the Live2.ai Android SDK into your application, you need to register your application with the Live2.ai platform and obtain a unique auth token ID. To get the auth token ID, you should:

  1. Register your application with the Live2.ai platform.

  2. Obtain your unique auth token.

Integrating Live2.ai Android SDK

To access the latest stable version of a library package from MavenCentral, ensure that your project is configured to use the MavenCentral repository in your build.gradle or build.gradle.kts file.

Gradle:

repositories {
    ...
    mavenCentral()
}

Include these dependencies according to your needs:

  • Live2.ai SDK: This is the core dependency for initializing the Live2.ai Android SDK and supporting video and livestream functionalities.

SDK Initialization

Call this code in your custom application class or in MainActivity onCreate method to initialize the Live2.ai SDK:

Kotlin:

class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val live2 = Live2SDK.installer(application, this)
            .userId(USER_ID) // Optional field to set the User ID in your eco-system.
            .authToken(TOKEN) // Client OAUTH Id
            .muteOnLaunch(false)
            .enableCaching(true)
            .maxCacheSizeBytes(MAX_CACHE_SIZE_IN_BYTES) // Max cache size used by video players, 25MB by default
            .enableForwardBackwardGestures(true)
            .enablePiP(true)
            .build()
    }
}

BOM (Bill of Material)

Since Live2.ai is developing multiple SDKs for various purposes, which might result in dependency conflicts, we have introduced a BoM (Bill of Materials) solution. This approach is useful when your app relies on multiple Live2.ai SDKs or open-source libraries from Live2.ai.

With this solution, your project's Gradle file should only specify the platform dependency with the latest BoM version.

Gradle:

val live2BomVersion = "latest_live2_bom_version" // eg. 1.0.1
implementation(platform("com.live2:live2-bom:$live2BomVersion"))

// no version is needed
implementation("com.live2:core")
implementation("com.live2:ui")
implementation("com.live2:player")

Setup your project

We recommend setting android:largeHeap="true" in the application tag within your AndroidManifest.xml file.

<application
        ......
        android:largeHeap="true">

    ......

</application>

Last updated