Install the Airbridge Android SDK and implement the necessary settings following the steps below.
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.
1. 请在 Project build.gradle
文件的 repositories
块中声明 Airbridge maven 仓库。
allprojects {
repositories {
maven { url "https://sdk-download.airbridge.io/maven" }
}
}
allprojects {
repositories {
maven("https://sdk-download.airbridge.io/maven")
}
}
2. 请在 Application 的 gradle
文件中,添加 Airbridge Android SDK 包。
dependencies {
// Get the latest version from https://sdk-download.airbridge.io/maven
implementation "io.airbridge:sdk-android:HERE_LATEST_VERSION"
// For example
// implementation "io.airbridge:sdk-android:0.0.0"
}
dependencies {
// Get the latest version from https://sdk-download.airbridge.io/maven
implementation("io.airbridge:sdk-android:HERE_LATEST_VERSION")
// For example
// implementation("io.airbridge:sdk-android:0.0.0")
}
提示
Airbridge Android SDK 需要 1.4 及以上版本的 Kotlin stdlib 和 Kotlinx coroutines 库。
Airbridge Android SDK 同时使用 JetBrains 的 Kotlin 和 Coroutines 库。
如果使用 .aar
手动安装 SDK,需要将以下 Dependency 库添加到 Project 中:
提示
请根据需求选择 General 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.
1. 请在 Project build.gradle
文件的 repositories
块中声明 Airbridge maven 仓库。
allprojects {
repositories {
maven { url "https://sdk-download.airbridge.io/maven" }
}
}
allprojects {
repositories {
maven("https://sdk-download.airbridge.io/maven")
}
}
2. 请在 Application 的 gradle
文件中,添加 Airbridge Android SDK 包。
dependencies {
// Get the latest version from https://sdk-download.airbridge.io/maven
implementation "io.airbridge:sdk-android-restricted:HERE_LATEST_VERSION"
// For example
// implementation "io.airbridge:sdk-android-restricted:0.0.0"
}
dependencies {
// Get the latest version from https://sdk-download.airbridge.io/maven
implementation("io.airbridge:sdk-android-restricted:HERE_LATEST_VERSION")
// For example
// implementation("io.airbridge:sdk-android-restricted:0.0.0")
}
提示
Airbridge Android SDK 需要 1.4 及以上版本的 Kotlin stdlib 和 Kotlinx coroutines 库。
Airbridge Android SDK 同时使用 JetBrains 的 Kotlin 和 Coroutines 库。
如果使用 .aar
手动安装 SDK,需要将以下 Dependency 库添加到 Project 中:
Initializing the Airbridge Android SDK in the Android Application class is recommended.
1. Create an Application class.
import android.app.Application
class AndroidApplication: Application() {
override fun onCreate() {
super.onCreate()
}
}
import android.app.Application;
public class AndroidApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
}
}
2. Set the generated Application in AndroidManifest.xml
.
<application
android:name=".AndroidApplication"
...>
3. Get Airbridge
from the Application class.
import co.ab180.airbridge.Airbridge
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.
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)
}
@Override
public void onCreate() {
super.onCreate();
// YOUR_APP_NAME: input your app name
// YOUR_APP_SDK_TOKEN: input your app token
AirbridgeOption option = new AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
.build();
Airbridge.initializeSDK(this, option);
}
注意
为确保正常工作,请在
Application
class 的onCreate
时调用initializeSDK
函数。
5. Set the following permissions.
Airbridge Android SDK 需要通过网络传输事件的权限。
请在 Application 的 AndroidManifest.xml
添加以下权限:
<manifest ...>
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
...
</manifest>
根据 Google 政策,针对 Android 13(API 33)及以上版本的 App 必须在 AndroidManifest.xml
文件中声明 Google Play 服务的一般权限才能获取设备的广告 ID(Advertising ID,简称 ADID)。
从 2.13.0 版本起,Airbridge Android SDK 会自动添加 AD_ID 权限,以获取 ADID。
如果未设置 LAT(Limit Ad Tracking,限制广告跟踪),但 GAID(Google Advertising ID,Google 广告 ID)显示为 00000000-0000-0000-0000-000000000000,则是由于 AD_ID 权限被第三方库等排除所致,请使用以下代码添加 AD_ID 权限以解决问题。
<manifest ...>
...
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
...
</manifest>
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 Airbridge generates a tracking link, it automatically selects and utilizes the optimal Airbridge deep link, depending on the environment. This link will be used for user redirection and is called the scheme deep link.
Airbridge Deeplink: https://YOUR_APP_NAME.airbridge.io/~~~
Scheme Deeplink: YOUR_SCHEME://product/12345
When the app is installed on a device and the user clicks the tracking link, the app opens through the Airbridge deep link. The Airbridge SDK converts the Airbridge deep link into a scheme deep link set on the tracking link. The converted scheme deep link is sent to the app.
When the app is not installed on a device and the user clicks the tracking link, the Airbridge deep link is saved. After the user moves to the app store or website and the app is installed and launched, the Airbridge SDK converts the saved Airbridge deep link into a scheme deep link. The converted scheme deep link is sent to the app.
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.
请前往 [追踪链接]>[深度链接] 并输入以下信息:
Android URI Scheme:根据 Android URI Scheme,将 Airbridge 深度链接转换为 URI Scheme 深度链接。App Link 和 URI Scheme 需要此信息。
Android 包名:用于识别 Android 包。App Link 和 URI Scheme 需要此信息。
Android sha256_cert_fingerprints:用于设置 App Link 域名。App Link 需要此信息。
注意
为确保正确的用户跳转,请为正式版 App 和开发用 App 注册不同的 Android URI Scheme 和 sha256_cert_fingerprints。
请按照以下步骤将上述信息注册至 Airbridge 面板。
1. 请前往 [追踪链接]>[深度链接]。
2. 请在 [Android URI Scheme] 中输入 Android URI Scheme,该 URI Scheme 必须与 ://
一起输入。例如,如果 Android URI Scheme 是 demo
,则输入 demo://
。
3. 请在 [Android 包名] 中输入 Android 包名。
4. 为了获取 sha256_cert_fingerprints,请在部署的 keystore 文件中运行以下命令:
keytool -list -v -keystore YOUR_KEYSTORE.keystore
请查看结果中的 SHA256 值。SHA256 值即是 sha256_cert_fingerprints。
Certificate fingerprints:
MD5: 4C:65:04:52:F0:3F:F8:65:08:D3:71:86:FC:EF:C3:49
SHA1: C8:BF:B7:B8:94:EA:5D:9D:38:59:FE:99:63:ED:47:B2:D9:5A:4E:CC
SHA256: B5:EF:4D:F9:DC:95:E6:9B:F3:9A:5E:E9:D6:E0:D8:F6:7B:AB:79:C8:78:67:34:D9:A7:01:AB:6A:86:01:0E:99
5. 请在 [sha256_cert_fingerprints] 中输入在步骤 4. 获取的 SHA256 值。
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.
请按照以下步骤进行设置,以确保用户点击追踪链接后,App 能通过 Airbridge 深度链接启用。
1. 请添加处理深度链接的 Activity。将 Activity class 文件添加到 src 中。
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class DeeplinkActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
public class DeeplinkActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
请在 AndroidManifest.xml
文件添加该 Activity。
<application
...>
<activity android:name=".DeeplinkActivity" />
</application>
2. 为了在 App 设置 Airbridge 深度链接的 URI Scheme 深度链接,请在 AndroidManifest.xml
的处理深度链接的 Activity 中添加 Intent Filter。
添加的 Intent Filter 必须使用在 Airbridge 面板中注册的 Android URI Scheme。请输入 Android URI Scheme,不包括 ://
。
<activity ...>
...
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="YOUR_SCHEME" />
</intent-filter>
...
</activity>
注意
必须输入不包括
://
的 Android URI Scheme。
3. 为了在 App 设置 Airbridge 深度链接的 App Link,请在 AndroidManifest.xml
的处理深度链接的 Activity 中添加以下 Intent Filter。
YOUR_APP_NAME
是 Airbridge App 名称。
<activity ...>
...
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="YOUR_APP_NAME.abr.ge" />
<data android:scheme="https" android:host="YOUR_APP_NAME.abr.ge" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="YOUR_APP_NAME.airbridge.io" />
<data android:scheme="https" android:host="YOUR_APP_NAME.airbridge.io" />
</intent-filter>
...
</activity>
启用 Airbridge 深度链接时,处理深度链接的 Activity 会使用 Airbridge.handleDeeplink
函数将 Airbridge 深度链接转换为 URI Scheme 深度链接。
转换后的 URI Scheme 深度链接将用户发送至预设的目标页面。
// when activity is opened with scheme deeplink or app links
override fun onResume() {
super.onResume()
// handle airbridge deeplink
val isHandled = Airbridge.handleDeeplink(intent) {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
if (isHandled) return
// when app is opened with other deeplink
// use existing logic as it is
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setIntent(intent)
}
// when activity is opened with scheme deeplink or app links
@Override
protected void onResume() {
super.onResume();
boolean isHandled = Airbridge.handleDeeplink(
getIntent(),
uri -> {
// when app is opened with airbridge deeplink
// show proper content using url (YOUR_SCHEME://...)
}
);
if (isHandled) return;
// when app is opened with other deeplink
// use existing logic as it is
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
提示
当输入的是 Airbridge 深度链接时,
Airbridge.handleDeeplink
函数会返回true
,并将转换后的 URI Scheme 深度链接传递给onSuccess
。如果输入的不是 Airbridge 深度链接,则返回false
,且不触发回调。
Airbridge.handleDeeplink
函数不会自动提供目标页面的跳转功能。请您通过传递给Airbridge.handleDeeplink
函数的onSuccess
的uri
,手动实现页面跳转逻辑。
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.
Airbridge SDK 在初始化以后,如果满足以下所有条件,会尝试获取深度链接。如果在获取深度链接的过程中 App 被关闭,Airbridge SDK 会将视为没有保存的深度链接。
已设置 Opt-in 时调用 Airbridge.startTracking
函数;或未设置 Opt-in。
用户在 ATT 弹窗中做出选择,或 ATT 弹窗中设置的事件收集延迟时间已到期。
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.
val isHandled = Airbridge.handleDeferredDeeplink {
// when app is opened with deferred deeplink
// show proper content using url
}
boolean isHandled = Airbridge.handleDeferredDeeplink(uri -> {
// when app is opened with deferred deeplink
// show proper content using url
});
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.
The SDK functionality test and deep link test allow you to check whether the SDK and deep linking work as intended.
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.
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
.
// Default log level = Log.INFO
val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
.setLogLevel(AirbridgeLogLevel.DEBUG)
.build()
Airbridge.initializeSDK(this, option)
AirbridgeOption option = new 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.
Event packet is stored in storage: categories={...}
: The event category is stored.
Send event packets to Airbridge: categories={...}
: Sending the event category.
Succeed to send event packets to Airbridge: categories={...}
: Sent the event category successfully through the network.
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.
Before testing the deep link, make sure the following items have been set up.
Item |
Description |
Resources |
---|---|---|
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.
Button |
Description |
Example |
---|---|---|
Test HTTP Deeplink Type-1 | Test the HTTP deep link in the format of |
|
Test HTTP Deeplink Type-2 | Test the HTTP deep link in the format of |
|
Test Scheme Deeplink | Test the scheme deep link. |
|
Test Deferred Deeplink | Test the deferred deep link. |
|
Test Custom Domain Deeplink | Test the custom domain. This button is only available when the custom domain is entered. |
|
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.
如果点击了 Test HTTP Deeplink Type-1,请在 SDK 日志检查:
eventData.deeplink
应为 https://{YOUR_APP_NAME}.abr.ge...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test HTTP Deeplink Type-2,请在 SDK 日志检查:
eventData.deeplink
应为 https://{YOUR_APP_NAME}.airbridge.io...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test Scheme Deeplink,请在 SDK 日志检查:
eventData.deeplink
应为 {YOUR_SCHEME}://main...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test Deferred Deeplink,请在 SDK 检查:
eventData.deeplink
应为 {YOUR_SCHEME}://main...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
如果点击了 Test Custom Domain Deeplink,请在 SDK 日志检查:
eventData.deeplink
应为 https://{YOUR_CUSTOM_DOMAIN}...
{YOUR_SCHEME}://main...
被传递给深度链接回调函数。
如果在深度链接测试网站输入了 Deeplink URL,传递给深度链接回调函数的信息将被更改。例如,输入 {YOUR_SCHEME}://path
时,传递的是 ${YOUR_SCHEME}://path...
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.
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. Refer to this article for the deep linking setup. |
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 |
Was this page helpful?