Skip to content

Bridge Integration for WebView-Based Mobile Apps

Many mobile apps are built on top of a WebView. FlareLane accounts for this by providing a variety of convenience features and bridge code for WebView-based apps.

The Problem with WebView-Based Mobile Apps

Section titled “The Problem with WebView-Based Mobile Apps”

In a WebView-based mobile app, the mobile app and the website run in separate environments, so the app has no way of knowing about actions that happen on the web.

To solve this, you need bridge code that propagates actions taken inside the WebView to the app as well. FlareLane is the only solution that builds and provides this bridge code itself.

Since the website is the primary platform where user actions occur, integrate the FlareLane Web SDK into the website currently displayed in the WebView.

Add the platform-specific bridge class provided by FlareLane to your WebView.

webview.addJavascriptInterface(
FlareLaneJavascriptInterface(context),
FlareLaneJavascriptInterface.BRIDGE_NAME
)
webView.configuration.userContentController.add(
FlareLaneJavascriptInterface(),
name: FlareLaneJavascriptInterface.BRIDGE_NAME
)

3. Integrate Customer Data via the Web SDK

Section titled “3. Integrate Customer Data via the Web SDK”

Once the integration is complete, the following functions called via the Web SDK inside the WebView will, through the bridge, also invoke the corresponding Mobile SDK functions in the app.

  • setUserId
  • trackEvent
  • setTags