> ## Documentation Index
> Fetch the complete documentation index at: https://help.airbridge.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK Migration - Android SDK

This article contains the information required to update the Airbridge Android SDK. We recommend checking the information regarding all versions.

## Update from v2.x to v4.0

Check the information below when updating the Airbridge Android SDK to v4.0. All changes are listed.

<Accordion title="List of all changes">
  ## Airbridge Interface

  ***

  ### Summary

  |         |                                                                                                                                                                                                                                                                                             |
  | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Unit    | `initializeSDK(app: Application, config: AirbridgeOption)`<br />Initializes the SDK with the provided app and AirbridgeOption.                                                                                                                                                              |
  | Unit    | `enableSDK()`<br />Enables the SDK.                                                                                                                                                                                                                                                         |
  | Unit    | `disableSDK()`<br />Disables the SDK.                                                                                                                                                                                                                                                       |
  | Boolean | `isSDKEnabled()`<br />Checks whether the SDK is currently enabled.                                                                                                                                                                                                                          |
  | Unit    | `startTracking()`<br />Starts collecting and transferring events.                                                                                                                                                                                                                           |
  | Unit    | `setDeviceAlias(key: String, value: String)`<br />Sets the key, value pair to the device alias.                                                                                                                                                                                             |
  | Unit    | `removeDeviceAlias(key: String)`<br />Removes the device alias with the given key.                                                                                                                                                                                                          |
  | Unit    | `clearDeviceAlias()`<br />Clears all device aliases.                                                                                                                                                                                                                                        |
  | Unit    | `setUserID(String)`<br />Sets the user ID.                                                                                                                                                                                                                                                  |
  | Unit    | `setUserEmail(String)`<br />Sets the user email.                                                                                                                                                                                                                                            |
  | Unit    | `setUserPhone(String)`<br />Sets the user phone number.                                                                                                                                                                                                                                     |
  | Unit    | `setUserAttribute(key: String, value: Int)`<br />Sets the key and value pair to the user attribute.                                                                                                                                                                                         |
  | Unit    | `setUserAttribute(key: String, value: Long)`<br />Sets the key and value pair to the user attribute.                                                                                                                                                                                        |
  | Unit    | `setUserAttribute(key: String, value: Float)`<br />Sets the key and value pair to the user attribute.                                                                                                                                                                                       |
  | Unit    | `setUserAttribute(key: String, value: Double)`<br />Sets the key and value pair to the user attribute.                                                                                                                                                                                      |
  | Unit    | `setUserAttribute(key: String, value: Boolean)`<br />Sets the key and value pair to the user attribute.                                                                                                                                                                                     |
  | Unit    | `setUserAttribute(key: String, value: String)`<br />Sets the key and value pair to the user attribute.                                                                                                                                                                                      |
  | Unit    | `removeUserAttribute(key: String)`<br />Removes the user attribute with the given key.                                                                                                                                                                                                      |
  | Unit    | `clearUserAttributes()`<br />Clears all user attributes.                                                                                                                                                                                                                                    |
  | Unit    | `setUserAlias(key: String, value: String)`<br />Sets the key and value pair to the user alias.                                                                                                                                                                                              |
  | Unit    | `removeUserAlias(key: String)`<br />Removes the user alias with the given key.                                                                                                                                                                                                              |
  | Unit    | `clearUserAlias()`<br />Clears all user aliases.                                                                                                                                                                                                                                            |
  | Unit    | `clearUser()`<br />Clears all user information.                                                                                                                                                                                                                                             |
  | Unit    | `registerPushToken(token: String)`<br />Registers the FCM registration token to track app uninstalls.                                                                                                                                                                                       |
  | Boolean | `isUninstallTrackingNotification(RemoteMessage)`<br />Silent notifications are sent without any data. However, the notification may be shown to the user depending on the onMessageReceived settings. This determines whether it is a push notification to track uninstalls.                |
  | Unit    | `trackEevnt(category: String, semanticAttributes: Map<String, Any> = null, customAttributes: Map<String, Any> = null)`<br />Tracks events.                                                                                                                                                  |
  | Boolean | `handleDeeplink(intent: Intent, onSuccess: OnSuccess<Uri>, onFailure: OnFailure? = null)`<br />Handles Airbridge's deep links from the provided intent and invokes a callback based on the result.                                                                                          |
  | Boolean | `handleDeferredDeeplink(onSuccess: OnSuccess<Uri?>, onFailure: OnFailure? = null)`<br />Handles deferred deep links and invokes a callback based on the result.                                                                                                                             |
  | Boolean | `click(trackingLink: URL, onSuccess: OnSuccess<Unit>, onFailure: OnFailure? = null)`<br />Queries the tracking link to the server to get the deep link information and then moves according to that information if a deep link is set up. It also adds a click event for the tracking link. |
  | Boolean | `impression(trackingLink: String, onSuccess: OnSuccess<Unit>, onFailure: OnFailure? = null)`<br />Adds an impression event for the tracking link.                                                                                                                                           |
  | Unit    | `setWebInterface(webView: WebView, webToken: String)`<br />Enables the Android SDK to automatically pull all events from the Web SDK that is installed on the website of the WebView environment.                                                                                           |
  | Boolean | `fetchDeviceUUID(onSuccess: OnSuccess<String>, onFailure: OnFailure? = null)`<br />Fetches the Device UUID using the provided callbacks for success and failure.                                                                                                                            |
  | Boolean | `fetchGoogleInstallReferrerDetails(onSuccess: OnSuccess<ReferrerDetails?>, onFailure: OnFailure? = null)`<br />Fetches the Google Install Referrer.                                                                                                                                         |
  | Boolean | `fetchHuaweiInstallReferrerDetails(onSuccess: OnSuccess<ReferrerDetails?>, onFailure: OnFailure? = null)`<br />Fetched the Huawei Install Referrer.                                                                                                                                         |
  | Boolean | `fetchOneStoreInstallReferrerDetails(onSuccess: OnSuccess<ReferrerDetails?>, onFailure: OnFailure? = null)`<br />Fetchs the Onestore Install Referrer.                                                                                                                                      |
  | Boolean | `fetchGalaxyStoreInstallReferrerDetails(onSuccess: OnSuccess<ReferrerDetails?>, onFailure: OnFailure? = null)`<br />Fetches the Galaxy Store Install Referrer.                                                                                                                              |
  | Boolean | `fetchMetaInstallReferrerDetails(onSuccess: OnSuccess<ReferrerDetails?>, onFailure: OnFailure? = null)`<br />Fetches the Meta Install Referrer.                                                                                                                                             |
  | Boolean | `fetchGoogleAdvertisingIdInfo(onSuccess: OnSuccess<AdvertisingIdInfo>, onFailure: OnFailure? = null)`<br />Fetches the Google Advertising ID info.                                                                                                                                          |
  | Boolean | `fetchHuaweiAdvertisingIdInfo(onSuccess: OnSuccess<AdvertisingIdInfo>, onFailure: OnFailure? = null)`<br />Fetches the Huawei Advertising ID info.                                                                                                                                          |

  ### Deprecated Interface

  |                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
  | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Unit                | `init(app: Application, config: AirbridgeConfig)`<br />**<em>This method was deprecated in v4.</em>**<br />use `initializeSDK(Application, AirbridgeOption)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
  | AirbridgeDeviceInfo | `getDeviceInfo()`<br />**<em>This method was deprecated in v4.</em>**<br />use `setDeviceAlias(String, String)`instead<br />use `removeDeviceAlias(String)` instead<br />use `clearDeviceAlias()` instead<br />use `fetchDeviceUUID(OnSuccess<String>, OnFailure?)` instead<br />use `fetchGoogleInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchHuaweiInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchOneStoreInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchGalaxyStoreInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchMetaInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchGoogleAdvertisingIdInfo(OnSuccess<AdvertisingIdInfo>, OnFailure?)` instead<br />use `fetchHuaweiAdvertisingIdInfo(OnSuccess<AdvertisingIdInfo>, OnFailure?)` instead |
  | AirbridgeUser       | `getCurrentUser()`<br />**<em>This method was deprecated in v4.</em>**<br />use `setUserID(String)` instead<br />use `setUserEmail(String)` instead<br />use `setUserPhone(String)` instead<br />use `setUserAttribute(String, Int)` instead<br />use `setUserAttribute(String, Long)`instead<br />use `setUserAttribute(String, Float)` instead<br />use `setUserAttribute(String, Double)` instead<br />use `setUserAttribute(String, Boolean)` instead<br />use `setUserAttribute(String, String)` instead<br />use `removeUserAttribute(String)` instead<br />use `clearUserAttributes()` instead<br />use `setUserAlias(String, String)` instead<br />use `removeUserAlias(String)` instead<br />use `clearUserAlias()` instead                                                                                                                                                                                                                       |
  | Unit                | `expireUser()`<br />**<em>This method was deprecated in v4.</em>**<br />use `clearUser()` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
  | Unit                | `trackEvent(category: StandardEventCategory, action: String? = null, label: String? = null, value: Number? = null, customAttributes: Map<String, Any?>? = null, semanticAttributes: Map<String, Any?>? = null)`<br />**<em>This method was removed in v4.</em>**<br />use `trackEvent(String, Map<String, Any>?, Map<String, Any>?)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
  | Unit                | `trackEvent(category: String, action: String? = null, label: String? = null, value: Number? = null, customAttributes: Map<String, Any?>? = null, semanticAttributes: Map<String, Any?>? = null)`<br />**<em>This method was deprecated in v4.</em>**<br />use `trackEvent(String, Map<String, Any>?, Map<String, Any>?)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
  | Unit                | `trackEvent(event: Event)`<br />**<em>This method was deprecated in v4.</em>**<br />use `trackEvent(String, Map<String, Any>?, Map<String, Any>?)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
  | Unit                | `getDeeplink(intent: Intent, callback: AirbridgeCallback<Uri>)`<br />**<em>This method was deprecated in v4.</em>**<br />use `handleDeeplink(Intent, OnSuccess<Uri>, OnFailure?)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
  | Unit                | `click(trackingLink: String, callback: AirbridgeCallback<Boolean>? = null)`<br />**<em>This method was deprecated in v4.</em>**<br />use `click(String, OnSuccess<Unit>, OnFailure?)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
  | Unit                | `impression(trackingLink: String)`<br />**<em>This method was deprecated in v4.</em>**<br />use `impression(String, OnSuccess<Unit>, OnFailure?)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
  | Unit                | `setJavascriptInterface(webView: WebView, webToken: String)`<br />**<em>This method was deprecated in v4.</em>**<br />use `setWebInterface(WebView, String)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

  ## Class changes

  ***

  ### Added

  | Class name          | Description                                                                                  |
  | ------------------- | -------------------------------------------------------------------------------------------- |
  | AirbridgeOption     | `initializeSDK(Application, AirbridgeOption)` 에서 사용하는 Option class                           |
  | AirbridgeCategory   | Key of Standard Event used on `trackEvent(String, Map<String, Any>?, Map<String, Any>?)`     |
  | AirbridgeAttributes | Key of Semantic Attribute used on `trackEvent(String, Map<String, Any>?, Map<String, Any>?)` |
  | OnSuccess           | OnSuccess callback                                                                           |
  | OnFailure           | OnFailure callback                                                                           |
  | AirbridgeLogLevel   | Airbridge log level                                                                          |

  ### Hidden

  | Class name | Description                                                                                                           |
  | ---------- | --------------------------------------------------------------------------------------------------------------------- |
  | Event      | **<em>This class was hidden in v4.</em>**<br />use `trackEvent(String, Map<String, Any>?, Map<String, Any>?)` instead |

  ### Removed

  | Class name                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
  | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | AirbridgeConfig                     | **<em>This class was removed in v4.</em>**<br />use `setWebInterface(WebView, String)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
  | StandardEventCategory               | **<em>This class was removed in v4.</em>**<br />use `AirbridgeCategory` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
  | SemanticAttributes                  | **<em>This class was removed in v4.</em>**<br />use `AirbridgeAttributes` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
  | Product                             | **<em>This class was removed in v4.</em>**<br />use `AirbridgeAttributes` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
  | AirbridgeCallback                   | **<em>This class was removed in v4.</em>**<br />use `OnSuccess<T>`, `OnFailure` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
  | OnDeferredDeeplinkReceiveListener   | **<em>This class was removed in v4.</em>**<br />use `handleDeferredDeeplink(OnSuccess<T>, OnFailure)` instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
  | OnDeferredDeeplinkDetermineListener | **<em>This class was removed in v4.</em>**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
  | AirbridgeDeviceInfo                 | **<em>This method was removed in v4.</em>**<br />use `setDeviceAlias(String, String)` instead<br />use `removeDeviceAlias(String)` instead<br />use `clearDeviceAlias()` instead<br />use `fetchDeviceUUID(OnSuccess<String>, OnFailure?)` instead<br />use `fetchGoogleInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchHuaweiInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchOneStoreInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchGalaxyStoreInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchMetaInstallReferrerDetails(OnSuccess<ReferrerDetails?>, OnFailure?)` instead<br />use `fetchGoogleAdvertisingIdInfo(OnSuccess<AdvertisingIdInfo>, OnFailure?)` instead<br />use `fetchHuaweiAdvertisingIdInfo(OnSuccess<AdvertisingIdInfo>, OnFailure?)` instead |
  | AirbridgeUser                       | **<em>This method was removed in v4.</em>**<br />use `setUserID(String)` instead<br />use `setUserEmail(String)` instead<br />use `setUserPhone(String)` instead<br />use `setUserAttribute(String, Int)` instead<br />use `setUserAttribute(String, Long)` instead<br />use `setUserAttribute(String, Float)` instead<br />use `setUserAttribute(String, Double)` instead<br />use `setUserAttribute(String, Boolean)` instead<br />use `setUserAttribute(String, String)` instead<br />use `removeUserAttribute(String)` instead<br />use `clearUserAttributes()` instead<br />use `setUserAlias(String, String)` instead<br />use `removeUserAlias(String)` instead<br />use `clearUserAlias()` instead                                                                                                                                                                                                                        |

  ### Moved

  | Class name        | Description                                  |
  | ----------------- | -------------------------------------------- |
  | AdvertisingIdInfo | Moved to `co.ab180.airbridge.common` package |
  | ReferrerDetails   | Moved `co.ab180.airbridge.common` package    |

  ## AirbridgeOption

  ***

  | AirbridgeConfig                                                               | AirbridgeOption                                                | default value               |
  | ----------------------------------------------------------------------------- | -------------------------------------------------------------- | --------------------------- |
  | `constructor(String, String)`                                                 | `constructor(String, String)`                                  | -                           |
  | `setSDKSignatureSecret(String, String)`                                       | `setSDKSignatureSecret(String, String)`                        | -                           |
  | `setLogLevel(int)`                                                            | `setLogLevel(AirbridgeLogLevel)`                               | `AirbridgeLogLevel.WARNING` |
  | `setSessionTimeoutSeconds(Long)`                                              | `setSessionTimeout(Long)`                                      | 300                         |
  | `setUserInfoHashEnabled(Boolean)`                                             | `setHashUserInformationEnabled(Boolean)`                       | true                        |
  | `setAutoStartTrackingEnabled(Boolean)`                                        | `setAutoStartTrackingEnabled(Boolean)`                         | true                        |
  | `setTrackAirbridgeLinkOnly(Boolean)`                                          | `setTrackAirbridgeDeeplinkOnlyEnabled(Boolean)`                | false                       |
  | `setTransmitEventOnBackgroundEnabled(Boolean)`                                | `setPauseEventTransmitOnBackgroundEnabled(Boolean)`            | false                       |
  | `setLocationCollectionEnabled(Boolean)`                                       | `setCollectLocationEnabled(Boolean)`                           | false                       |
  | `setFacebookDeferredAppLinkEnabled(Boolean)`                                  | `setTrackMetaDeferredAppLinkEnabled(Boolean)`                  | false                       |
  | `setErrorLogCollectionEnabled(Boolean)`                                       | `setErrorLogCollectionEnabled(Boolean)`                        | true                        |
  | `setResetEventBufferEnabled(Boolean)`                                         | `setClearEventBufferOnInitializeEnabled(Boolean)`              | false                       |
  | `setSdkEnabled(Boolean)`                                                      | `setSdkEnabled(Boolean)`                                       | true                        |
  | `setAppMarketIdentifier(String)`                                              | `setAppMarketIdentifier(String)`                               | “”                          |
  | `setPlatform(String)`                                                         | `setSDKDevelopmentPlatform(String)`                            | “native”                    |
  | `setEventMaximumBufferCount(Int)`                                             | `setEventBufferCountLimit(Int)`                                | Int.MAX\_VALUE              |
  | `setEventMaximumBufferSize(Long)`                                             | `setEventBufferSizeLimit(Long)`                                | Long.MAX\_VALUE             |
  | `setEventTransmitInterval(Long)`                                              | `setEventTransmitInterval(Long)`                               | 0                           |
  | `setCustomDomains(List<String>)`                                              | `setCustomDomains(List<String>)`                               | emptyList()                 |
  | `setOnDeferredDeeplinkReceiveListener(OnDeferredDeeplinkReceiveListener)`     | <em>remove</em>                                                | -                           |
  | `setOnDeferredDeeplinkDetermineListener(OnDeferredDeeplinkDetermineListener)` | <em>remove</em>                                                | -                           |
  | `setOnAttributionResultReceiveListener(OnAttributionResultReceiveListener)`   | `setOnAttributionReceived(OnAttributionResultReceiveListener)` | null                        |
  | `setFacebookOnDeviceAttribution(String)`                                      | `setMetaInstallReferrer(String)`                               | null                        |
  | `setLifecycleIntegration(AirbridgeLifecycleIntegration)`                      | `setLifecycleIntegration(AirbridgeLifecycleIntegration)`       | null                        |
</Accordion>

### SDK Initialization

`Airbridge.init(Application, AirbridgeConfig)` has been changed to `Airbridge.initializeSDK(Application, AirbridgeOption)`.

`AirbridgeConfig` has been changed to `AirbridgeOption`. `AirbridgeConfig.Builder`has been changed to `AirbridgeOptionBuilder`. Some function names in the  `AirbridgeOptionBuilder` have been changed or deleted.

Refer to the example below.

<CodeGroup>
  ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  override fun onCreate() {
      super.onCreate()
      val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
          .build()
      Airbridge.initializeSDK(this, option)
  }
  ```

  ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  @Override
  public void onCreate() {
      super.onCreate();
      AirbridgeOption option = new AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
          .build();
      Airbridge.initializeSDK(this, option);
  }
  ```
</CodeGroup>

### Deep Link

The function name has been changed from `getDeeplink()` to `handleDeeplink()`. `AirbridgeCallback` has been removed. The `OnSuccess` and `OnFailure` listener have been added. You can check whether the function worked by its return value.

<CodeGroup>
  ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  val result = Airbridge.handleDeeplink(
      intent = intent
      onSuccess = { },
      onFailure = { }
  )
  ```

  ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  boolean result = Airbridge.handleDeeplink(
          intent,
          uri -> { },
          throwable -> { }
  );
  ```
</CodeGroup>

We have improved the existing deferred deep link code logic that adds a `listener` to make screen transitions more convenient. The previous method of adding a `listener` has been removed. Instead, you can receive deferred deep links through the Airbridge interface.

<Accordion title="Required: Deferred deep link processing">
  * You can call `handleDeeplink` and its value from the activity configuration.
  * You can check with the result value whether the deferred deep links can be handled.
  * Deferred deep links are designed to be acquired only once after the app install. If the value is already acquired or called first, the result is `false`.

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.handleDeferredDeeplink(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.handleDeferredDeeplink(
            uri -> { },
            throwable -> { }
    );
    ```
  </CodeGroup>
</Accordion>

### Set up custom domain

The method of specifying custom domain URLs in the `res/values/airbridge.xml` file, used in version 2.x, has been changed. You can now add custom domain links by using the `setTrackingLinkCustomDomains`  function during Airbridge SDK initialization.

<CodeGroup>
  ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  // YOUR_APP_NAME: input your app name
  // YOUR_APP_SDK_TOKEN: input your app token
  // YOUR_APP_CUSTOM_DOMAIN: input your app custom domain. ex) example.domain.com
  val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
      .setTrackingLinkCustomDomains(listOf("YOUR_APP_CUSTOM_DOMAIN"))
      .build()
  Airbridge.initializeSDK(this, option)
  ```

  ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  // YOUR_APP_NAME: input your app name
  // YOUR_APP_SDK_TOKEN: input your app token
  // YOUR_APP_CUSTOM_DOMAIN: input your app custom domain. ex) example.domain.com
  AirbridgeOption option = new AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
      .setTrackingLinkCustomDomains(Arrays.asList("YOUR_APP_CUSTOM_DOMAIN"))
      .build();
  Airbridge.initializeSDK(this, option);
  ```
</CodeGroup>

### In-app events and user data

The following APIs have been deleted. Also, `StandardEventCategory`, `SemanticAttributes`, and `Product` have been removed.

* `trackEvent(category: StandardEventCategory, action: String? = null, label: String? = null, value: Number? = null, customAttributes: Map<String, Any?>? = null, semanticAttributes: Map<String, Any?>? = null)`
* `trackEvent(category: String, action: String? = null, label: String? = null, value: Number? = null, customAttributes: Map<String, Any?>? = null, semanticAttributes: Map<String, Any?>? = null)`
* `trackEvent(event: Event)`

New APIs have been added.

* `trackEvent(category: String, semanticAttributes: Map<String, Any>? = null, customAttributes: Map<String, Any>? = null)`
* `AirbridgeCategory` has been added. The event category string is predefined.
* The function override and objects (`SemanticAttributes`, `Product`) for passing additional information were deleted.
* Instead, it has been modified to transmit attributes through a map. The key value of the map is predefined in `AirbridgeAttribute` as a string. Custom attributes can be sent directly as a string.

Refer to the AirbridgeCategory, AirbridgeAttribute mapping and `trackEvent` function below.

<AccordionGroup>
  <Accordion title="Event Category of Standard Events provided by the SDK (AirbridgeCategory)">
    | Key                     | Data                                     |
    | ----------------------- | ---------------------------------------- |
    | SIGN\_UP                | airbridge.user.signup                    |
    | SIGN\_IN                | airbridge.user.signin                    |
    | SIGN\_OUT               | airbridge.user.signout                   |
    | HOME\_VIEWED            | airbridge.ecommerce.home.viewed          |
    | PRODUCT\_LIST\_VIEWED   | airbridge.ecommerce.productList.viewed   |
    | SEARCH\_RESULTS\_VIEWED | airbridge.ecommerce.searchResults.viewed |
    | PRODUCT\_VIEWED         | airbridge.ecommerce.product.viewed       |
    | ADD\_PAYMENT\_INFO      | airbridge.addPaymentInfo                 |
    | ADD\_TO\_WISHLIST       | airbridge.addToWishlist                  |
    | ADDED\_TO\_CART         | airbridge.ecommerce.product.addedToCart  |
    | INITIATE\_CHECKOUT      | airbridge.initiateCheckout               |
    | ORDER\_COMPLETED        | airbridge.ecommerce.order.completed      |
    | ORDER\_CANCELED         | airbridge.ecommerce.order.canceled       |
    | START\_TRIAL            | airbridge.startTrial                     |
    | SUBSCRIBE               | airbridge.subscribe                      |
    | UNSUBSCRIBE             | airbridge.unsubscribe                    |
    | AD\_IMPRESSION          | airbridge.adImpression                   |
    | AD\_CLICK               | airbridge.adClick                        |
    | COMPLETE\_TUTORIAL      | airbridge.completeTutorial               |
    | ACHIEVE\_LEVEL          | airbridge.achieveLevel                   |
    | UNLOCK\_ACHIEVEMENT     | airbridge.unlockAchievement              |
    | RATE                    | airbridge.rate                           |
    | SHARE                   | airbridge.share                          |
    | SCHEDULE                | airbridge.schedule                       |
    | SPEND\_CREDITS          | airbridge.spendCredits                   |
  </Accordion>

  <Accordion title="Semantic Attributes provided by the SDK (AirbridgeAttribute)">
    | Key                                   | Data                            | Data type |
    | ------------------------------------- | ------------------------------- | --------- |
    | ACTION                                | action                          | string    |
    | LABEL                                 | label                           | string    |
    | VALUE                                 | value                           | float     |
    | CURRENCY                              | currency                        | string    |
    | PRODUCTS                              | products                        | array     |
    | PRODUCT\_ID                           | productID                       | string    |
    | PRODUCT\_NAME                         | name                            | string    |
    | PRODUCT\_PRICE                        | price                           | float     |
    | PRODUCT\_QUANTITY                     | quantity                        | int       |
    | PRODUCT\_CURRENCY                     | currency                        | string    |
    | PRODUCT\_POSITION                     | position                        | int       |
    | PRODUCT\_CATEGORY\_ID                 | categoryID                      | string    |
    | PRODUCT\_CATEGORY\_NAME               | categoryName                    | string    |
    | PRODUCT\_BRAND\_ID                    | brandID                         | string    |
    | PRODUCT\_BRAND\_NAME                  | brandName                       | string    |
    | PERIOD                                | period                          | string    |
    | IS\_RENEWAL                           | isRenewal                       | boolean   |
    | RENEWAL\_COUNT                        | renewalCount                    | int       |
    | PRODUCT\_LIST\_ID                     | productListID                   | string    |
    | CART\_ID                              | cartID                          | string    |
    | TRANSACTION\_ID                       | transactionID                   | string    |
    | TRANSACTION\_TYPE                     | transactionType                 | string    |
    | TRANSACTION\_PAIRED\_EVENT\_CATEGORY  | transactionPairedEventCategory  | string    |
    | TRANSACTION\_PAIRED\_EVENT\_TIMESTAMP | transactionPairedEventTimestamp | int       |
    | TOTAL\_QUANTITY                       | totalQuantity                   | int       |
    | QUERY                                 | query                           | string    |
    | IN\_APP\_PURCHASED                    | inAppPurchased                  | boolean   |
    | CONTRIBUTION\_MARGIN                  | contributionMargin              | float     |
    | LIST\_ID                              | listID                          | string    |
    | RATE\_ID                              | rateID                          | string    |
    | RATE                                  | rate                            | float     |
    | MAX\_RATE                             | maxRate                         | float     |
    | ACHIEVEMENT\_ID                       | achievementID                   | string    |
    | SHARED\_CHANNEL                       | sharedChannel                   | string    |
    | DATE\_TIME                            | datetime                        | string    |
    | DESCRIPTION                           | description                     | string    |
    | IS\_REVENUE                           | isRevenue                       | boolean   |
    | PLACE                                 | place                           | string    |
    | SCHEDULE\_ID                          | scheduleID                      | string    |
    | TYPE                                  | type                            | string    |
    | LEVEL                                 | level                           | string    |
    | SCORE                                 | score                           | float     |
    | AD\_PARTNERS                          | adPartners                      | array     |
    | IS\_FIRST\_PER\_USER                  | isFirstPerUser                  | boolean   |
  </Accordion>

  <Accordion title="Example) trackEvent function">
    <CodeGroup>
      ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
      Airbridge.trackEvent(
          AirbridgeCategory.ORDER_COMPLETED,
          mapOf(
              // action
              AirbridgeAttribute.ACTION to "Tool",
              // label
              AirbridgeAttribute.LABEL to "Hammer",
              // value
              AirbridgeAttribute.VALUE to 10,
              // semantic attribute (provided by sdk)
              AirbridgeAttribute.CURRENCY to "USD",
              AirbridgeAttribute.PRODUCTS to listOf(
                  mapOf(
                      // semantic attribute value (provided by sdk)
                      AirbridgeAttribute.PRODUCT_ID to "12345",
                      // semantic attribute value (not provided by sdk)
                      "name" to "PlasticHammer",
                  ),
              ),
              // semantic attribute (not provided by sdk)
              "totalQuantity" to 1,
          ),
          mapOf(
              // custom attribute
              "promotion" to "FirstPurchasePromotion",
          )
      )
      ```

      ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
      Airbridge.trackEvent(
              AirbridgeCategory.ORDER_COMPLETED,
              new HashMap() {{
                  // action
                  put(AirbridgeAttribute.ACTION, "Tool");
                  // label
                  put(AirbridgeAttribute.LABEL, "Hammer");
                  // value
                  put(AirbridgeAttribute.VALUE, 10);
                  // semantic attribute (provided by sdk)
                  put(AirbridgeAttribute.CURRENCY, "USD");
                  put(AirbridgeAttribute.PRODUCTS, Arrays.asList(
                      new HashMap() {{
                          // semantic attribute value (provided by sdk)
                          put(AirbridgeAttribute.PRODUCT_ID, "12345");
                          // semantic attribute value (not provided by sdk)
                          put("name", "PlasticHammer");
                      }}
                  ));
                  // semantic attribute (not provided by sdk)
                  put("totalQuantity", 1);
                  
              }},
              new HashMap() {{
                  // custom attribute
                  put("promotion", "FirstPurchasePromotion");
              }}
      );
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

`AirbridgeUser` has been deleted. You can now access the interface through the Airbridge interface that was previously accessible through `AirbridgeUser`.

<Accordion title="Required: Airbridge interface">
  Instead of accessing the code through `Airbridge.getUserInfo()`, you need to replace it with the following Airbridge interface.

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    fun setUserID(id: String)
    fun setUserEmail(email: String)
    fun setUserPhone(phone: String)

    fun setUserAttribute(key: String, value: Int)
    fun setUserAttribute(key: String, value: Long)
    fun setUserAttribute(key: String, value: Float)
    fun setUserAttribute(key: String, value: Double)
    fun setUserAttribute(key: String, value: Boolean)
    fun setUserAttribute(key: String, value: String)
    fun removeUserAttribute(key: String)
    fun clearUserAttributes()

    fun setUserAlias(key: String, value: String)
    fun removeUserAlias(key: String)
    fun clearUserAlias()

    fun clearUser()
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    void setUserID(String id)
    void setUserEmail(String email)
    void setUserPhone(String phone)

    void setUserAttribute(String key, int value)
    void setUserAttribute(String key, long value)
    void setUserAttribute(String key, float value)
    void setUserAttribute(String key, double value)
    void setUserAttribute(String key, boolean value)
    void setUserAttribute(String key, String value)
    void removeUserAttribute(String key)
    void clearUserAttributes()

    void setUserAlias(String key, String value)
    void removeUserAlias(key: String)
    void clearUserAlias()

    void clearUser()
    ```
  </CodeGroup>
</Accordion>

`AirbridgeDeviceInfo` has been deleted. The interface that was accessed through `AirbridgeDeviceInfo` has been modified so that it can now be accessed through the Airbridge interface.

`AirbridgeCallback` has been deleted and `OnSuccess`, `OnFailure` listener has been added. You can receive the success status through this listener.

<Accordion title="Required: OnSuccess, OnFailure">
  You need to replace the codes that enables access through Airbridge.getDeviceInfo() with the following Airbridge interface.

  #### Device UUID

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.fetchDeviceUUID(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.fetchDeviceUUID(
            uuid -> { },
            throwable -> { }
        );
    ```
  </CodeGroup>

  #### Install referrer

  ###### fetch Google Install referrer

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.fetchGoogleInstallReferrerDetails(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.fetchGoogleInstallReferrerDetails(
            referrerDetails -> { },
            throwable -> { }
    );
    ```
  </CodeGroup>

  ###### fetch Huawei Install referrer

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.fetchHuaweiInstallReferrerDetails(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.fetchHuaweiInstallReferrerDetails(
            referrerDetails -> { },
            throwable -> { }
        );
    ```
  </CodeGroup>

  ###### fetch Galaxy store Install referrer

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.fetchGalaxyStoreInstallReferrerDetails(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.fetchGalaxyStoreInstallReferrerDetails(
            referrerDetails -> { },
            throwable -> { }
        );
    ```
  </CodeGroup>

  ###### fetch Meta Install referrer

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.fetchMetaInstallReferrerDetails(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.fetchMetaInstallReferrerDetails(
            referrerDetails -> { },
            throwable -> { }
        );
    ```
  </CodeGroup>

  #### Advertising ID

  ###### fetch Google Advertising ID

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.fetchGoogleAdvertisingIdInfo(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.fetchGoogleAdvertisingIdInfo(
            advertisingIdInfo -> { },
            throwable -> { }
        );
    ```
  </CodeGroup>

  ###### fetch Huawei Advertising ID

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    val result = Airbridge.fetchHuaweiAdvertisingIdInfo(
        onSuccess = { },
        onFailure = { }
    )
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean result = Airbridge.fetchHuaweiAdvertisingIdInfo(
            advertisingIdInfo -> { },
            throwable -> { }
        );
    ```
  </CodeGroup>
</Accordion>

`AirbridgeDeviceInfo` has been deleted. There is no function to receive the `attribution result` through the Airbridge interface. However, it can be received through the listener of `AirbridgeOption`, which is an existing method.

<CodeGroup>
  ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  class App : Application() {

      override fun onCreate() {
          super.onCreate()
          val option: AirbridgeOption = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
              .setOnAttributionReceived { result ->
                  // do something
              }
              .build()
          Airbridge.initializeSDK(this, option)
      }
  }
  ```

  ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  class App extends Application {
      
      @Override
      public void onCreate() {
          super.onCreate();
          
          Airbridge.initializeSDK(this,
                  new AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
                          .setOnAttributionReceived(result -> {
                              // do something
                          })
                          .build()
                  );
      }
  }
  ```
</CodeGroup>

`AirbridgeCallback` has been deleted and `OnSuccess`, `OnFailure` listeners have been added. You can check the operation status of the function through the return value.

<Accordion title="Example) click and impression functions">
  ###### click

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    fun click(
        trackingLink: String,
        onSuccess: OnSuccess<Unit>? = null,
        onFailure: OnFailure? = null
    ): Boolean
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean click(
        @NonNull String trackingLink,
        @Nullable OnSuccess<Unit> onSuccess,
        @Nullable OnFailure onFailure
    )
    ```
  </CodeGroup>

  ###### impression

  <CodeGroup>
    ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    fun impression(
        trackingLink: String,
        onSuccess: OnSuccess<Unit>? = null,
        onFailure: OnFailure? = null
    ): Boolean
    ```

    ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    boolean impression(
        @NonNull String trackingLink,
        @Nullable OnSuccess<Unit> onSuccess,
        @Nullable OnFailure onFailure
    )
    ```
  </CodeGroup>
</Accordion>

### Hybrid app integration

The function name has been changed from `setJavascriptInterface()` to `setWebInterface()`.

<CodeGroup>
  ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  Airbridge.setWebInterface(webview, "YOUR_WEB_TOKEN")
  ```

  ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  Airbridge.setWebInterface(webview, "YOUR_WEB_TOKEN")
  ```
</CodeGroup>

## Update within v2.x

This section describes the major changes in each version of the Android SDK.

### v2.24.0

For apps registered with Airbridge after September 4, 2023, we’ve resolved the issue where the deep-link URL provided in the deep-link callback was decoding the content entered in the Airbridge dashboard twice.

This issue occurred in Android SDK from v2.22.0 to v2.23.0.

### v2.21.2

An initialization option has been added to stop sending events when the app is in the background.

* You can use the `AirbridgeConfig#setTransmitEventOnBackgroundEnabled`function to stop sending events when the app is in the background.
* The default value is `true`. When `true`, the remaining events are sent even when the app is in the background.

### v2.21.1

`deeplink.page` has been deprecated. From v2.21.1 onwards, we recommend writing code using the `abr.ge` deep link domain.

`deeplink.page` is still supported and operates for backward compatibility.

### v2.19.1

* Changes have been made so that `ORGANIC_REOPEN`, `FOREGROUND` events that occur within the session time are not collected by default.
* BACKGROUND events have been removed.

### v2.18.0

Deeplink Pageview events will only be collected when `Airbridge.click` is called.

<link rel="alternate" hrefLang="en" href="https://help.airbridge.io/en/developers/migration-guide-for-android-sdk-v4" />

<link rel="alternate" hrefLang="ko" href="https://help.airbridge.io/ko/developers/migration-guide-for-android-sdk-v4" />
