Skip to main content

LiveLike Android Mobile Plugin

Requirements​

  • Android SDK version 23 or above

Add LiveLike SDK library to your project​

Package​

With a VXP GitHub account you can use package implementation by authorising your repository, i.e.

    def githubProperties = new Properties()
githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
maven {
url = uri("https://maven.pkg.github.com/deltatre-vxp/diva-android-releases")
credentials {
username = githubProperties['github.usr']
password = githubProperties['github.key']
}
}

// diva
implementation "com.deltatre.diva:divalivelikeplugin:1.0.1"

You will need to have a relevant Personal Access Token with package read permissions in order to utilise this approach.

Dependencies​

Diva LiveLike Module requires the following dependencies to be added at app-level

dependencies {
...
implementation 'com.livelike.android-engagement-sdk:engagementsdk:2.71.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.deltatre.diva:divacorelib:5.3.1'
...
}

Usage​

Initialization​

To use the LiveLikeModule, you need to initialize it first by calling the init() method. Here is an example:

    val context: Context = applicationContext
val pluginManager: IPluginManager = PluginManager()
val callbackRegister: ICallbackRegister<PlayerCallback> = CallbackRegister()
val clientId = "Your Live Like Client ID"

LiveLikeModule.init(context, pluginManager, callbackRegister, clientId)

Chat Module​

Integration​

The Chat module provides a MenuPanelPlugin that can be used in Diva. Here is an example of how to integrate it:

    val chat = LiveLikeModule.Chat
.setMenuTitle("Chat")
.setAnalyticId("LiveLike Chat")

val menuPanelDefinition = chat.build()
if (menuPanelDefinition != null) {
// This will automatically try to add the plugin to Dive's Plugin manager
menuPanelDefinition.addPlugin()
}

val chatModuleCallback = object : ChatModuleCallback {
// Common plugin callback
fun onPluginPresented() {
// Indicate that the plugin is presented
}
fun onPluginPresent() {
// Indicate that the plugin is going to be presented
}
fun onPluginDismiss() {
// Indicate that the plugin is going to be dismissed
}
fun onPluginDismissed() {
// Indicate that the plugin is dismissed
}
fun onPluginStateChanged(pluginState: PluginState) {
// Indicate that the plugin's state changed
}
fun onPluginError(pluginError: PluginError) {
// Used in case of error with the plugin
}
// Callback specific to Chat
override fun onStatusChanged(status: LLComponentStatus) {
// Handle different Chat status
}
override fun onRequireAttention(isRequired: Boolean) {
// Handle require attention changed
}
override fun onError(error: ComponentModuleError) {
// Handle chat module error
}
}
chat.registerChatCallbackListener(chatModuleCallback)

// When you want to remove the Chat module from the application
chat.dispose()

Configuration​

You can configure the Chat's parameters by using the updateParameters() method. Here is an example:

    chat.updateParameters(chatId = "Chat ID", chatType = "Chat Type", is24_7 = false)

Widget Module​

Integration​

The Chat module provides a FloatingPanelPlugin that can be used in Diva. Here is an example of how to integrate it:

    val widget = LiveLikeModule.Widget
.setAnalyticId("LiveLike Widget")

val floatingPanelDefinition = widget.build()
if (floatingPanelDefinition != null) {
// This will automatically try to add the plugin to Dive's Plugin manager
floatingPanelDefinition.addPlugin()
}

val widgetModuleCallback = object : WidgetModuleCallback {
// Common plugin callback
fun onPluginPresented() {
// Indicate that the plugin is presented
}
fun onPluginPresent() {
// Indicate that the plugin is going to be presented
}
fun onPluginDismiss() {
// Indicate that the plugin is going to be dismissed
}
fun onPluginDismissed() {
// Indicate that the plugin is dismissed
}
fun onPluginStateChanged(pluginState: PluginState) {
// Indicate that the plugin's state changed
}
fun onPluginError(pluginError: PluginError) {
// Used in case of error with the plugin
}
// Callback specific to Widget
override fun onStatusChanged(status: LLComponentStatus) {
// Handle different Widget status
}
override fun onPositionChange(position: FloatingPanelPositionPlugin) {
// Handle floating panel position changed
}
override fun onError(error: ComponentModuleError) {
// Handle Widget module error
}
}
chat.registerChatCallbackListener(chatModuleCallback)

// When you want to remove the Chat module from the application
chat.dispose()

Configuration​

You can configure the Widget's parameters by using the updateParameters() method. Here is an example:

    widget.updateParameters(programId = "LiveLike program Id", is24_7 = false)

Customization​

You can customize the Widgets appearance with your own theme by using the addCustomWidgetTheme() method. Here is an example:

    val inputStream = context.assets.open("livelike_diva_theme.json")
val jsonString = inputStream.bufferedReader().use{it.readText()}
val jsonObjectTheme = JsonParser.parseString(jsonString).asJsonObject
widget.addCustomWidgetTheme(jsonObjectTheme)

Cleanup​

When your application is destroyed, you should call the dispose() method to clean up the Chat and Widget modules.

    LiveLikeModule.dispose()

If you need to remove only one of the Module (Chat or Widget), you can use the specific dispose() methond:

    LiveLikeModule.Chat.dispose()
LiveLikeModule.Widget.dispose()