Skip to main content
This reference covers the Android wiring for the WebView bridge. The dashboard generates a starting snippet with your agent’s real URL: open DistributeMobile App, turn on Enable Bridge Events, and select the Kotlin/Android tab. The snippet on this page also relays widget messages to the app, which the bridge requires.

Requirements

  • android.webkit.WebView with JavaScript and DOM storage enabled
  • A @JavascriptInterface object registered under the name AndroidBridge
  • Enable Bridge Events turned on for the agent

Snippet

Message wiring

The init runs in onPageFinished, which can fire before the widget mounts. A tars:init posted that early is dropped and never answered. Resend tars:init until a tars:ready carrying capabilities arrives, because a repeat init after the handshake is ignored. The snippet above posts the init once, so add the resend before you ship it. Handle at least tars:navigate, tars:data, and tars:close: the three capabilities the bridge declares in its tars:ready reply to tars:init. Field-level payloads for every message are in the bridge events reference.