Step1. Installation

    Step1. Installation


    Article summary

    You should register ShopLiveHandler

    Please register ShopLive.setHandler to implement your business logic on each button clicks.

    Please 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.5.11"
      
        // Shoplive live player
        implementation "cloud.shoplive:shoplive-sdk:$shoplive_sdk_version"
    }

    Integrated library

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

    Individual library components

    dependencies {
        def shoplive_sdk_version = "1.5.11"
        def your_exoplayer_version = "2.19.1"
        def your_media3_version = "1.3.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.** { *; }