Communication
This guide explains how to establish seamless bidirectional communication between your Android app and the LiSA Player running within a WebView. By leveraging native-to-JavaScript bridges and WebView event listeners, you can enable your Android app and the LiSA Player to exchange data, trigger events, and synchronize state in real time.
Whether you need to send commands from you app to the LiSA Player (e.g., changing app behavior or updating content) or pass data from the WebView back to your app (e.g., user actions or analytics), this guide will walk you through the necessary setup and best practices for efficient, secure, and reliable communication.
Receiving Messages
To receive messages from the LiSA Player In your Android app, use addJavascriptInterface
:
The
WebAppInterface
is registered under the nameMessageFromLiSA
.When the LiSA Player sends a message using
window.MessageFromLiSA.postMessage
, thepostMessage
function in the interface processes it.You can handle the JSON message inside the
postMessage
method.
Sending messages
Use the evaluateJavascript
method in Kotlin to send a message to the web app:
Last updated