Step1. Installing the SDK

    Step1. Installing the SDK


    Article summary

    You should register ShopLiveHandler

    Register the ShopLive.setHandler to implement your business logic on each button clicks. Refer to the Handler registration guide.

    Select a library

    You can import Live library, Integrated library, or individual library components separately upon your needs.

    Live library

    dependencies {
        def shoplive_sdk_version = "1.6.2"
      
        // Shoplive live player
        implementation "cloud.shoplive:shoplive-sdk:$shoplive_sdk_version"
    }

    Integrated library

    dependencies {
        def shoplive_sdk_version = "1.6.2"
        
        // Shoplive combined packaging
        implementation "cloud.shoplive:shoplive-sdk-all:$shoplive_sdk_version" // live + short-form
    }

    Individual library components

    dependencies {
        def shoplive_sdk_version = "1.6.2"
        def your_exoplayer_version = "2.19.1"
        def your_media3_version = "1.4.1"
        def shoplive_exoplayer_version = your_exoplayer_version + "." + "8"
        def shoplive_media3_version = your_media3_version + "." + "8"
        
        // Shoplive split packaging
        implementation "cloud.shoplive:shoplive-common:$shoplive_sdk_version" // must required
        implementation "cloud.shoplive:shoplive-exoplayer:$shoplive_exoplayer_version" // must required
        // When using media3. Exoplayer will be deprecated soon.
        // https://developer.android.com/guide/topics/media/media3/getting-started/migration-guide
        // implementation "cloud.shoplive:shoplive-media3:$shoplive_media3_version" 
        implementation "cloud.shoplive:shoplive-network:$shoplive_sdk_version" // must required
      
        implementation "cloud.shoplive:shoplive-sdk-core:$shoplive_sdk_version" // for live player
      
        implementation "cloud.shoplive:shoplive-short-form:$shoplive_sdk_version" // for short-form player
    }


    Handler

    Register a Handler to receive multiple events from the Shoplive Android SDK.

    ShopLive.setHandler(object : ShopLiveHandler() {
        override fun handleNavigation(context: Context, url: String) {
            // Do something
        }
    })


    Add Proguard Rule

    If you do an R8 Build, you may run into obfuscation issues, add the following:

    -keep public class cloud.shoplive.** { *; }
    -dontwarn cloud.shoplive.**
    -keep class org.json.** { *; }