DeepLink - Android SDK

Install the Airbridge Android SDK and implement the necessary settings following the steps below.

Install SDK

The Airbridge Android SDK can be installed using the method below. After installation, check whether the SDK has been properly installed through the Android SDK test.

注意

使用 Gradle 时,如果在 Project build.gradle 文件中存在 repositories 块,参考 Gradle (build.gradle),如果在 Project settings.gradle 文件中存在 repositories 块,参考 Gradle (settings.gradle)

Install Restricted SDK

提示

请根据需求选择一般 SDK 或 Restricted SDK, 只能安装其中一个。

Depending on policies and environments, restrictions on collecting device IDs like GAID and IDFA may be required. When installing the Restricted SDK version, the device IDs are not collected.

Install the Restricted SDK using the method below.

注意

使用 Gradle 时,如果在 Project build.gradle 文件中存在 repositories 块,参考 Gradle (build.gradle),如果在 Project settings.gradle 文件中存在 repositories 块,参考 Gradle (settings.gradle)

Initialize SDK

Initializing the Airbridge Android SDK in the Android Application class is recommended.

1. Create an Application class.

12345678
import android.app.Application

class AndroidApplication: Application() {

    override fun onCreate() {
        super.onCreate()
    }
}

2. Set the generated Application in AndroidManifest.xml.

AndroidManifest.xml
123
 <application
        android:name=".AndroidApplication"
        ...>

3. Get Airbridge from the Application class.

1
import co.ab180.airbridge.Airbridge

4. Add the following code snippet to the Application class file registered in AndroidManifest.xml.

The YOUR_APP_NAME and YOUR_APP_SDK_TOKEN can be found on the [Settings]>[Tokens] page in the Airbridge dashboard.

12345678
override fun onCreate() {
    super.onCreate()
    // YOUR_APP_NAME: input your app name
    // YOUR_APP_SDK_TOKEN: input your app token
    val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
        .build()
    Airbridge.initializeSDK(this, option)
}

注意

为确保正常工作,请在 Application class 的 onCreate 时调用 initializeSDK 函数。

5. Set the following permissions.

Deep Linking

Deep linking allows you to redirect users from ads to specific locations within your app. The data collected from the tracking link enables you to monitor the performance of the deep link in Airbridge.

When a user clicks on the Airbridge tracking link, the scheme deep link embedded in the tracking link is converted into an Airbridge Deep Link, which can be either an HTTP deep link or a scheme deep link. This Airbridge Deep Link redirects the user to the desired app location. Then, the Airbridge SDK converts the Airbridge Deep Link back to the original scheme deep link embedded in the tracking link and passes it to the app.

  • Example scheme deep link embedded in the tracking link: YOUR_SCHEME://product/12345

  • Examples of Airbridge Deep Links

    • HTTP deep link format 1: https://YOUR_APP_NAME.airbridge.io/~~~

    • HTTP deep link format 2: https://YOUR_APP_NAME.abr.ge/~~~

    • Scheme deep link format: YOUR_SCHEME://product/12345?airbridge_referrer=~~~

When the app is installed on the device and the tracking link is clicked, the app opens through the Airbridge Deep Link. The Airbridge SDK converts the Airbridge Deep Link into the scheme deep embedded in the tracking link and passes it to the app.

When the app is not installed on the device and the tracking link is clicked, the Airbridge SDK saves the Airbridge Deep Link. After the user is redirected to the app store or website and the app is installed and launched, the Airbridge SDK converts the saved Airbridge Deep Link into the scheme deep link embedded in the tracking link and passes it to the app.

Set up deep linking

For the deep linking setup, the deep link information entered to the Airbridge dashboard and the in-app location address for user redirection is required.

First, enter the deep link information into the Airbridge dashboard.

After entering the deep link information into the Airbridge dashboard, additional setup is required to enable the following.

  • App launch with Airbridge deep links

  • User redirection with Airbridge deep links

For detailed instructions, refer to the information below.

Set up deferred deep linking

When a user clicks on a tracking link with deferred deep linking capabilities and your app is not installed on the device, the Airbridge SDK collects the deep link as follows.

The Airbridge.handleDeferredDeeplink function collects the saved Airbridge deep link and converts it into a scheme deep link to pass it to the app. Users are redirected to the intended destination using the converted scheme deep link.

123456
val isFirstCalled = Airbridge.handleDeferredDeeplink { uri ->
    // when handleDeferredDeeplink is called firstly after install
    if (uri != null) {
        // show proper content using uri (YOUR_SCHEME://...)
    }
}

The Airbridge.handleDeferredDeeplink function returns true if it has been called for the first time after the install and waits for the Airbridge deep link to be retrieved, converts it to a scheme deep link to pass it to onSuccess. You can use this scheme deep link to send users to the intended destination.

If there is no stored Airbridge deep link, null is passed to onSuccess. If the SDK is not initialized or if the Airbridge.handleDeferredDeeplink function has not been called for the first time, false will be returned.

The scheme deep link is usually a URL in the form of YOUR_SCHEME://... If you use services like Meta Deferred App Links, a different form of URL may be passed.

Testing

The SDK functionality test and deep link test allow you to check whether the SDK and deep linking work as intended.

Test SDK functionality

Check whether the Airbridge Android SDK is operating properly. The Install events are collected by the Android SDK regardless of whether the additional configurations have been completed or not.

Check Install event collection

Follow the steps below to check whether the Install events are being collected by the Android SDK.

1. Prepare a test device where the app is not installed, or if the app is already installed, delete it before testing.

2. Set the SDK log level to DEBUG.

12345
// Default log level = Log.INFO
val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
    .setLogLevel(AirbridgeLogLevel.DEBUG)
    .build()
Airbridge.initializeSDK(this, option)

3. Install the app on the test device. After installing the app, launch it so that the Install event is collected.

The first Open event collected by Airbridge is recorded as an Install event. Therefore, the Open may not be recorded when the app install event is collected.

4. Use LogCat in the Android Studio or the Android Debug Bridge (ADB) to check whether the event performed on the test device with a specific GAID is logged properly. If the Install events are being collected properly, you should see logs such as the following.

  • Send event packets to Airbridge: categories={9161}

  • Send event packets to Airbridge: categories={9163}

For the LogCat messages and their meaning, refer to the following.

5. If you can't see the logs in LogCat even after a sufficient amount of time has passed, check whether the SDK has been initialized, the SDK configurations are completed as instructed, and the network status is stable.

If the problem persists, contact your Airbridge CSM and share your SDK logs. If you don't have a designated Airbridge CSM, contact the Airbridge Help Center.

Check whether the deep linking feature configured in the Airbridge Android SDK works as intended.

Preliminary check up

Before testing the deep link, make sure the following items have been set up.

#{"width":"120px"}

Item

#{"width":"240px"}

Description

HTTP Deep Link (App links)

Setup is required

Scheme Deep Link

Setup is required

Deferred Deep Link

The setup is completed automatically. No additional setup is required.

Custom Domain

Setup is optional

App Install

- If you don't need to test the deferred deep link, install the app on your test device in advance.

- If you need to test the deferred deep link, the app should not be installed on the test device. If the app is installed, delete the app from the test device.

Airbridge provides a website for testing deep links. If you want to test deferred deep links, you need to uninstall the app from your test device.

1. Visit the deep link testing site from your test device. You can access the website directly by using the QR code below.

2. Enter the App Name you registered with Airbridge. You can find it on the [Settings]>[Tokens] page in the Airbridge dashboard.

If you want to test a specific deep link address, enter the scheme deep link into the Deeplink URL field. The scheme deep link format is {YOUR_SCHEME}://...If you're using a custom domain, make sure to enter your custom domain.

3. Click one of the buttons listed below. Click the button depending on the deep link type you are testing.

Note that you can only test deferred deep links if the app is not installed on your test device.

#{"width":"120px"}

Button

#{"width":"240px"}

Description

#{"width":"140px"}

Example

Test HTTP Deeplink Type-1

Test the HTTP deep link in the format of https://{your_app-name}.abr.ge.

https://{your_app-name}.abr.ge/@{your_app-name}/test_sdk?...

Test HTTP Deeplink Type-2

Test the HTTP deep link in the format of https://abr.ge. The address format is different from Test HTTP Deeplink Type-1.

https://abr.ge/@{your_app-name}/test_sdk?...

Test Scheme Deeplink

Test the scheme deep link.

https://abr.ge/@{your_app-name}/test_sdk?...

Test Deferred Deeplink

Test the deferred deep link.

https://abr.ge/@{your_app-name}/test_sdk?...

Test Custom Domain Deeplink

Test the custom domain. This button is only available when the custom domain is entered.

https://{your_custom_domain}/@{your_app-name}/test_sdk?...

4. Use LogCat in the Android Studio or the Android Debug Bridge (ADB) to check whether the event performed on the test device with a specific GAID is logged properly. If the Install events are being collected properly, you should see logs as follows.

  • Send event packets to Airbridge: categories={9161}

  • Send event packets to Airbridge: categories={9163}

  • Send event packets to Airbridge: categories={9168}

If the SDK log level has been set to DEBUG in the Airbridge SDK initialization process, you can check the value sent through the network.

5. The client request: method={...} message transmits the header and body values. Check the following items based on the button clicked on the deep link test site. If the deep link is working properly, all items should be confirmed.

6. If you can't see the logs in LogCat even after a considerable amount of time has passed, check whether the SDK has been initialized, the SDK configurations are completed as instructed, and the network status is stable.

If the problem persists, contact your Airbridge CSM and share your SDK logs. If you don't have a designated Airbridge CSM, contact the Airbridge Help Center.

Troubleshooting

Refer to the information below for troubleshooting regarding deep links.

Problem

Solution

You clicked a deep link, but the app was not launched. Or the SDK logs show information that is not intended as per setting.

Check whether the deep link is set up correctly.

You clicked a deep link, and the app was launched, but you didn't land on the intended app page.

You need to write code that redirects the user to the deep link path that is passed by the onSuccessfunction.

Additional SDK Settings

Refer to the information below for additional setup.

提示

此功能并非必需功能,请在设置前确认需求。

提示

此功能并非必需功能,请在设置前确认需求。

Tracking links are links that are embedded in ads for data collection. When users click on the ad, the tracking link is used to pass the touchpoint data to Airbridge, allowing for ad attribution.

Also, users who click on the ad with a tracking link can be redirected to a specific destination.

Use the createTrackingLink function to create tracking links. Refer to the code examples and the parameter details below.

123456789101112
fun createTrackingLink(
    channel: String,
    option: Map<String, Any>,
    onSuccess: OnSuccess<AirbridgeTrackingLink>
)

fun createTrackingLink(
    channel: String,
    option: Map<String, Any>,
    onSuccess: OnSuccess<AirbridgeTrackingLink>,
    onFailure: OnFailure?
)

Name

Required or Optional

Type

Description

channel

Required

String

The ad channel where the tracking link is used

option

Required

Map<String, String>

Options for creating tracking links

onSuccess

Required

OnSuccess<AirbridgeTrackingLink>

Success callback

onFailure

Optional

OnFailure

Fail callback

Use the option parameter in the createTrackingLink function to configure tracking link options.

Use the onSuccess callback in the createTrackingLink function to pass the AirbridgeTrackingLink.

1234
data class AirbridgeTrackingLink(
    val shortURL: Uri,
    val qrcodeURL: Uri
)

Name

Type

Description

shortURL

Uri

The short URL of the tracking link

qrcodeURL

Uri

The QR code URL of the tracking link

Refer to the example codes below.

Was this helpful?

Any questions or suggestions?