Adobe Launch Android SDK

GitHub 版本(最新日期)GitHub 版本(最新日期)

向您的 Adobe Marketing Cloud 应用添加 Branch 深度链接和归因的功能。借助 Branch 的链接平台,移动开发人员和营销者可以通过世界一流的深度链接和归因来发展他们的移动业务。


Google Play Services 17+版本

2019年6月 Google Play Services 进行的一次重大更新导致 Branch 的 Android SDK(以及其他各种跨平台 SDK,例如 Unity)停止收集 Android AID。

To ensure Branch deep linking and attribution continue to work, you must follow Google's update instructions here.

如果您运行的 Google Play Services 版本低于17,则无需更新。


  1. 使用 Adobe SDK 追踪的所有事件将自动发送到 Branch,无需进行任何其他工作
  2. 所有核心 Branch 功能均可访问
  3. The SDK will automatically pick up the Adobe ID's


  • Android API 级别16或更高
  • Adobe 核心平台


不需要 Branch SDK

由于 Adobe Branch 扩展是自动包含 Branch SDK 的子依赖项的包装,因此您无需(我们也不建议)在应用中单独使用 Branch SDK。


An example app can be found in the AdobeBranchExtension-Android repository, in the AdobeBranchExample



请注意,Adobe Experience Platform(AEP)SDK 和 AdobeMobileLibrary 不能共存于同一项目中。

这是有关如何在应用中使用 AdobeBranchExtension 的简要概述:

  1. You'll need to configure your app and get a Branch API key in the Branch Metrics dashboard. You can read more about configuring your dashboard in the Branch docs here.

  2. 对于应用集成,您需要按照此处 Branch 文档中所述的说明进行操作(忽略 “Load Branch” 和 “Initialize Branch” 部分):

  3. 要进行深度链接,您需要将 Branch domain,应用 URI scheme 和 Branch Key 添加到应用的 Manifest 文件中。

  4. 在 Adobe 操作后台 (Dashboard)中,激活 Branch 并将您的 Branch key 添加到应用的配置中。


  1. 将 AdobeBranchExtension 添加到应用的 build.gradle。
    implementation ''

  2. Register the Branch AdobeBranchExtension with MobileCore in configureWithAppID

public class CustomApplicationClass extends Application {
    private static final String MY_ADOBE_APP_ID = "launch-{adobe app guid}-development";

    public void onCreate() {


        try {
            MobileCore.start(new AdobeCallback () {
                @Override public void call(Object o) {
        } catch (InvalidInitException ignored) {}
  1. Initialize Branch session and register BranchReferralInitListener in your launcher activity's onStart method. You can see some best practices on deep link routing in this doc
AdobeBranch.initSession(new Branch.BranchReferralInitListener() {
    public void onInitFinished(JSONObject referringParams, BranchError error) {
    try {
      // Retrieve deep link params and route to content appropriately
      if (referringParams.has("+clicked_branch_link") && referringParams.getBoolean("+clicked_branch_link")) {
        // Handle your Branch deep link routing in the callback
    } catch (JSONException e) {
      // referringParams property doesn't exist
}, getIntent().getData(), this);

By default, AdobeBranch will delay session initialization by 750 milliseconds in order to wait for Adobe Launch to initialize and to collect Adobe IDs from it. If you do not wish to delay session initialization, pass in 0 as the delay parameter in the method below.

AdobeBranch.initSession(Branch.BranchReferralInitListener callback, Uri data, Activity activity, int delay)

实现 Branch 功能

Once you've added the AdobeBranchExtension and Branch, you can always use Branch features directly (with the exception of getAutoInstanceinitSessionreInitSessionsessionBuilder methods). You can learn about using the Branch features here, in the Branch documentation for Android.


通过注册白名单选择性地追踪 Branch 中的某些事件:

List<AdobeBranch.EventTypeSource> apiWhitelist = new ArrayList<>();
apiWhitelist.add(new AdobeBranch.EventTypeSource("com.adobe.eventType.generic.track", "com.adobe.eventSource.requestContent"));
apiWhitelist.add(new AdobeBranch.EventTypeSource("io.branch.eventType.generic.track", "io.branch.eventSource.requestContent"));


请注意,默认情况下会处理所有 Adobe Events。要有选择地跟踪具有自定义名称的事件,可以按以下步骤注册白名单:


  • 白名单配置必须在 Adobe 初始化完成之后进行。
  • 空的白名单将不会监听任何事件。
  • 白名单为空(默认)将侦听所有 Adobe 事件。
  • 非空的白名单将仅侦听列表中的那些事件。

Disable Event Sharing between Adobe/Branch

To disable Event Sharing between Adobe and Branch (empty whitelist), add the following code:

// Disable event sharing by creating an empty whitelist
List<AdobeBranch.EventTypeSource> apiWhitelist = new ArrayList<>();
apiWhitelist.add(new AdobeBranch.EventTypeSource("", ""));


当您在 Adobe Launch 中追踪动作和状态时,动作和状态消息也会被发送到 Branch,并在 Branch 操作后台显示。这使您可以在 App 的操作中追踪深度链接活动和病毒共享的有效性。

如果使用 trackAction function 追踪 Adobe 事件,则自定义事件将位于 Branch 操作后台 (Dashboard)上的 “Analytics Track” 下。如果使用 dispatchEvent function 追踪 Adobe 事件,则自定义事件将位于Branch 操作后台 (Dashboard)上的自定义名称下。

private void doPurchase(View view) {
        Long timestamp = System.currentTimeMillis()/1000;

        Map<String, Object> eventData = new HashMap<>();
        eventData.put(AdobeBranch.KEY_AFFILIATION, "Branch Metrics Company Store");
        eventData.put(AdobeBranch.KEY_COUPON, "SATURDAY NIGHT SPECIAL");
        eventData.put(AdobeBranch.KEY_CURRENCY, "USD");
        eventData.put(AdobeBranch.KEY_DESCRIPTION, model.getDescription());
        eventData.put(AdobeBranch.KEY_REVENUE, model.getPrice());
        eventData.put(AdobeBranch.KEY_SHIPPING, 0.99);
        eventData.put(AdobeBranch.KEY_TAX, (model.getPrice() * 0.077));
        eventData.put(AdobeBranch.KEY_TRANSACTION_ID, UUID.randomUUID().toString());

        eventData.put("category", "Arts & Entertainment");
        eventData.put("product_id", model.getId());
        eventData.put("sku", "sku-be-doo");
        eventData.put("timestamp", timestamp.toString());

        eventData.put("custom1", "Custom Data 1");
        eventData.put("custom2", "Custom Data 2");

        Event newEvent = new Event.Builder("PURCHASE",

        // dispatch the analytics event
        MobileCore.dispatchEvent(newEvent, this);

Define an Allow List of Event Names



You can either define an allow list or an exclusion list of events but you can't define both. If you don't configure any, all events will send to Branch, which is not ideal.

// Define the allow list of the event names

Define an Exclusion List of Event Names



You can either define an exclusion list or an allow list of events but you can't define both. If you don't configure any, all events will send to Branch, which is not ideal.

// Define the exclusion list of the event names

Register the AdobeBranchExtension

Once the Allow or Exclusion event names list has been configured, the AdobeBranchExtension needs to be registered.

// Register the AdobeBranchExtension
AdobeBranchExtension.registerExtension(this, true);