Skip to main content
This webpage is exclusively for selected customers and should not be shared with others.

Overview


When an Airbridge tracking link opens within your app’s WebView environment, the deep linking user experience can be degraded compared to when it opens in another app. This document describes how to resolve this issue by having the Airbridge SDK open the tracking link instead of the WebView when a tracking link is clicked within the WebView environment. This document will guide you through the following steps to resolve the issue:
  1. An explanation of the Airbridge SDK function that opens tracking links.
  2. Detecting when a tracking link is clicked within the app’s WebView.
  3. Configuring the Airbridge SDK to open the tracking link instead.
AttentionIf another company’s tracking link is opened in your app, and that other company’s app is not installed and the tracking link’s fallback is set to a web URL, the fallback web page will open in the user’s default browser, not the WebView.
The Airbridge SDK provides a function called Placement Click which allows you to open tracking links from the native part of your application. You can use this feature with the following code. You can also pass an AirbridgeCallback<Boolean> as a parameter to Airbridge.click to receive a callback for the response.
In WebViewClient, you can implement WebViewClient#shouldOverrideUrlLoading to detect when a specific URL is being loaded and decide whether to proceed with loading it or to stop it. Follow the steps below to implement the code to detect if the URL is an Airbridge tracking link. 📘WebViewClient Android Developer Documentation

Using WebViewClient

To implement WebViewClient#shouldOverrideUrlLoading, create a webViewClient instance and set it to the webView using webView#setWebViewClient. The result of WebViewClient#shouldOverrideUrlLoading returns whether the WebResourceRequest was handled. Implement WebViewClient#shouldOverrideUrlLoading to detect which URL is being loaded. The URL being loaded is passed in the form of request.url from the WebResourceRequest function argument.
Among the URLs being loaded, identify the ones that are Airbridge tracking links. An Airbridge tracking link will have a URL host of abr.ge, YOUR_APP_NAME.deeplink.page, or a custom domain. 📘 You can find YOUR_APP_NAME in your dashboard under Settings > Tokens > App Name.

With the steps above, you can now detect when an Airbridge tracking link is loaded in a WebView. When a link is detected, use the Airbridge.click function and return true from webView#shouldOverrideUrlLoading. This will have the Airbridge SDK open the tracking link instead of the WebView.

Conclusion


The implementation is now complete. Below is the full code used in this guide.