Example

    Example


    The content is currently unavailable in English. You are viewing the default Korean version.
    Article summary

            //AccessKey를 설정합니다.
            ShopLiveCommon.setAccessKey(accessKey: "{ACESSKEY}")
            //간편 유저인증을 설정합니다.
            let user = ShopLiveCommonUser(userId: "{USER_ID}")
            ShopLiveCommon.setUser(user: user)
            //선택
            //간편 유저인증대신 보안이 강화된 JWT로 인증을 진행합니다
            let jwt = "{JWT}"
            ShopLiveCommon.setAuthToken(authToken: jwt)
            //광고 트래킹 등 라이브 동영상에 필요한 정보를 기입합니다.
            val queries: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2")
            for ((key, value) in queries) {
                  ShopLive.addParameter(key, value)
            }
            // utm 관련한 정보들은 중복 방지를 위해서 아래 처럼 별도의 API로 정보를 기입합니다.
            ShopLiveCommon.setUtmMedium(utmMedium: "UTM_MEDIUM")
            ShopLiveCommon.setUtmSource(utmSource: "UTM_SOURCE")
            ShopLiveCommon.setUtmContent(utmContent: "UTM_CONTENT")
            ShopLiveCommon.setUtmCampaign(utmCampaign: "UTM_CAMPAIGN")
            private val shopliveHandler = object : ShopLiveHandler() {
                     // url을 받아 원하는 동작을 합니다.  
                     override fun handleNavigation(context: Context, url: String) {
                            //원하는 동작
                     }
                     // 웹뷰의 정의된 명령어에 대한 동작을 합니다.
                     override fun onReceivedCommand(context: Context, command: String, data: JSONObject) {
                                   when(command) {
                                      "CLICK_PRODUCT_CART" -> {
                                          // 원하는 동작
                                      }
                                   }
                     }
            }
            ShopLive.setHandler(shopliveHandler)
            // 공유하기를 눌렀을때 공유 주소를 설정합니다.
            ShopLive.setShareScheme("https://somedeeplink.com")
            //플레이어를 실행합니다.
            ShopLive.play(this, ShopLivePlayerData("campaignKey")
            //프리뷰를 실행합니다.
            ShopLive.showPreviewPopup(this, ShopLivePreviewData("campaignKey"))


    What's Next