Requirements
android.webkit.WebViewwith JavaScript and DOM storage enabled- A
@JavascriptInterfaceobject registered under the nameAndroidBridge - 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.
