Implementing the Brand Likes and Follows feature
- Print
Implementing the Brand Likes and Follows feature
- Print
Article summary
Did you find this summary helpful?
Thank you for your feedback
The "Like" or "Follow" feature for brands registered by customers can be enabled in the Shoplive Player. When this feature is activated, a button to "Like" or "Follow" a brand, along with the brand's image, will be displayed within the Shoplive Player. The state of this button is synchronized with customer data configured by the customer's settings.
To integrate this feature, Shoplive’s consultation is necessary. For detailed information, contact to the Shoplive (ask@shoplive.cloud) representative.
Display the Brand Likes
val user = ShopLiveUser().apply {
userId = "harry"
userName = "potter"
addCustomParameter("brand", "{\"identifier\":\"brand-identifier\",\"favorite\":true}")
}
ShopLive.setUser(user)
messageCallback of a Like button click
override fun onReceivedCommand(context: Context, command: String, data: JSONObject) {
when (command) {
"ON_CLICK_BRAND_FAVORITE_BUTTON" -> {
val identifier = data.getString("identifier")
val isFavorite = data.getBoolean("favorite")
Log.d("shoplive", "identifier=$identifier, isFavorite=$isFavorite")
}
"ON_CHANGED_BRAND_FAVORITE" -> {
val identifier = data.getString("identifier")
Log.d("shoplive", "identifier=$identifier")
}
}
}
Pass the status of Likes to Shoplive Player
You can link the brand like (follow) status by transmitting the user's brand like (follow) status to the Shoplive Player.
val result = "{\"identifier\":\"brand-identifier\",\"favorite\":false}"
ShopLive.sendCommandMessage("SET_BRAND_FAVORITE", result)