Handler

    Handler


    Article summary

    Handler

    Shoplive Shortform Notifications are received by the client through the Handler function and process as needed.

    ShopLiveShortform.setHandler(object : ShopLiveShortformHandler() {
    	override fun getOnClickProductListener(): ShopLiveShortformProductListener {
    	    return ShopLiveShortformProductListener { data, product ->
    	        // Something landing customer
        	}
    	}
    
    	override fun getOnClickBannerListener(): ShopLiveShortformUrlListener {
        	return ShopLiveShortformUrlListener { data, url ->
            	// Something landing customer
    	    }
    	}
    
    	override fun onEvent(context: Context, command: String, payload: String?) {
    		// Do something
    	}
            
    	override fun onError(context: Context, error: ShopLiveCommonError) {
    		// Do something
    	}
            
    	override fun onShare(context: Context, data: ShopLiveShortformShareData) {
    		// Do something
    	}
      
    	override fun onCreate() {
    		// Do something
    	}
      
    	override fun onDestroy() {
    		// Do something
    	}
    })

    onEvent(context: Context, command: String, payload: String?)

    Shoplive Shortform provides a messageCallback function that allows you to directly handle various events that occur.

    Shortform Events


    onError(context: Context, error: ShopLiveCommonError)

    Provides a messageCallback function that allows direct handling of errors occurring in Shoplive Shortform.

    • ShopLiveCommonError

      field

      type

      description

      code

      Int

      ShopLiveCommonErrorCode

      message

      String?

      Error message

      cause

      Throwable?

      Error cause

    onShare(context: Context, data: ShopLiveShortformShareData)

    Developing direct sharing functionality in Shoplive Shortform.

    • ShopLiveShortformShareData

      field

      type

      description

      shortsId

      String?

      Shortform unique identifier

      srn

      String?

      ID containing unique information for Shortform

      title

      String?

      Shortform title (for og tag purposes)

      description

      String?

      Shortform description (for og tag purposes)

      thumbnail

      String?

      Shortform thumbnail (for og tag purposes)

    onCreate()

    You can develop features required for entering the Shortform detail view

    onDestroy()

    You can develop features required for closing the Shortform detail view


    ShopLiveShortformProductListener

    onClick(data: ShopLiveShortformIdentifier?, product: ShopLiveShortformProductData)

    Develop the direct product click feature in Shoplive Shortform. Creating a product

    • ShopLiveShortformIdentifier

      field

      type

      description

      shortsId

      String?

      Shortform unique identifier

      srn

      String?

      ID containing unique information for Shortform

    • ShopLiveShortformProductData

      field

      type

      description

      brand

      String?

      Brand information of the product

      currency

      String?

      Currency of the product

      description

      String?

      Description of the product

      discountPrice

      Double?

      Discounted price of the product

      discountRate

      Double?

      Discount percentage of the product

      imageUrl

      String?

      Product image URL

      name

      String?

      Product name

      originalPrice

      Double?

      Regular price of the product

      productId

      Long?

      Unique ID of the product, automatically issued upon product registration

      showPrice

      Boolean

      Displayed price of the product

      sku

      String?

      Unique SKU information of the product

      url

      String?

      URL of the product's detailed page

    ShopLiveShortformUrlListener

    onClick(data: ShopLiveShortformIdentifier?, url: String)

    You can develop a direct product banner click feature in Shoplive Shortform. creating a product banner

    • ShopLiveShortformIdentifier

    field

    type

    description

    shortsId

    String?

    Shortform unique identifier

    srn

    String?

    ID containing unique information for Shortform