For the complete documentation index, see llms.txt. This page is also available as Markdown.

Android


This guide explains how to embed the LiSA Player in an Android WebView and enable two-way communication..

Setting Up the WebView

Use the Android WebView component to load the LiSA Player. Here’s a complete example:

import android.os.Bundle
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.appcompat.app.AppCompatActivity

class WebViewActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        // Prevent WebView from resizing when keyboard opens
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)

        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_webview)

        val webView: WebView = findViewById(R.id.webView)
        webView.webViewClient = WebViewClient()

        // Enable JavaScript
        val webSettings: WebSettings = webView.settings
        webSettings.javaScriptEnabled = true
        webSettings.cacheMode = WebSettings.LOAD_DEFAULT

        // Allow Media Playback Inline
        webSettings.mediaPlaybackRequiresUserGesture = false

        // Load the web app URL
        webView.loadUrl("https://{clientId}.loveslisa.tech/s/{showId}")
    }
}

Passing Safe-Area Insets

Android WebViews do not natively support safe-area-insets. To address this, inject CSS variables for safe-area compensation into the LiSA Player:

Then adjust the creation of the webViewClient to this:

Make sure to calculate topInset, bottomInset, leftInset, and rightInset using Android's safe area utilities.

Last updated