Skip to main content
The recommended way to integrate Molin AI in your Android app is by rendering our widget inside a WebView component. See the full working example on GitHub: molin-ai/molin-ai-android-example.

Basic setup

Create an HTML file that loads the widget and displays the chat component fullscreen. Place it at app/src/main/assets/widget.html:
Replace YOUR_WIDGET_ID with your actual widget ID from the Molin dashboard. The show-close attribute is optional. It renders a close button (✕) in the chat header, which is useful when the widget is displayed fullscreen in a webview. You can omit it if your app has its own navigation to dismiss the chat.

Loading the WebView

Create a layout with a fullscreen WebView (res/layout/activity_main.xml):
Then load the HTML file in your activity:

Handling the close button

When the user taps the close button, the <molin-shop-ai-chat> element fires a molin-shop-ai-chat:close-click event. Navigate to a custom molin:// URL to tell the native side to go back:
On the Kotlin side, intercept the molin:// scheme in a WebViewClient: