Adobe Launch Android SDK

GitHub release (latest by date)GitHub release (latest by date)

Add the power of Branch deep linking and attribute to your Adobe Marketing Cloud app. With Branch's linking platform, mobile developers and marketers can grow their mobile business with world class deep linking and attribution.

❗️

Google Play Services version 17+

A major Google Play Services change made in June 2019 has caused Branch's Android SDK (and various other cross-platform SDKs, e.g. Unity) to stop collecting Android AID.

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

If you are running Google Play Services versions below 17, no update is necessary.

Features

  1. All events tracked with the Adobe SDK will automatically be sent to Branch without any extra work
  2. All core Branch functionality is accessible
  3. The SDK will automatically pick up the Adobe ID's

요구 사항

  • Android API level 16 or higher
  • Adobe Core Platform

👍

Branch SDK not Required

As the Adobe Branch extension is a wrapper that auto includes a sub-dependency for the Branch SDK, you do not need to - nor do we recommend to - implement the Branch SDK separately in your app.

Example Apps

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

Installation & Usage

❗️

Note that the Adobe Experience Platform (AEP) SDK and AdobeMobileLibrary cannot coexist in the same project.

Here's a brief outline of how to use the AdobeBranchExtension in your app:

  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. For application integration, you'll need to follow the instructions as described in the Branch docs here (ignore sections "Load Branch" and "Initialize Branch"):

  3. For deep linking, you will need to add the Branch domains, app URI scheme and your Branch key to your app's manifest file.

  4. In the Adobe dashboard, activate Branch and add your Branch key to your app's configuration.

imageimage

  1. Add the AdobeBranchExtension to your app's build.gradle.
    implementation 'io.branch.sdk.android:adobebranchextension:1.+'

  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";

    @Override
    public void onCreate() {
        super.onCreate();

        MobileCore.setApplication(this);

        try {
            AdobeBranchExtension.registerExtension(this);
            MobileCore.start(new AdobeCallback () {
                @Override public void call(Object o) {
                    MobileCore.configureWithAppID(ADOBE_APP_ID);
                }
            });
        } 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() {
  @Override
    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)

Implementing Branch Features

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

Register an Event Whitelist

화이트리스트를 등록하여 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"));

AdobeBranch.registerAdobeBranchEvents(apiWhitelist);

Note that all Adobe Events are processed by default. To optionally track events with custom names you can register a whitelist as follows:

Additional Whitelist Configuration Implementation Notes:

  • Whitelist Configuration must happen after Adobe Initialization has completed.
  • An empty whitelist will not listen for any events.
  • A null whitelist (default) will listen for all Adobe events.
  • A non-empty whitelist will listen for only those events that are in the list.

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("", ""));
AdobeBranch.registerAdobeBranchEvents(whitelist);

Automatic: Track Action and State

Adobe Launch에서 액션 및 상태를 트래킹할 때 액션 및 상태 메시지는 Branch에도 전송되고 Branch 대시보드에 표시됩니다. 이를 통해 앱의 액션에서 딥링크(Deep Link) 캠페인 및 바이럴 공유의 효과를 트래킹할 수 있습니다.

If the trackAction function is used to track Adobe events, custom events will come under "Analytics Track" on the Branch dashboard. If dispatchEvent function is used to track Adobe events, custom events will come under the custom names on the 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",
                "com.adobe.eventType.generic.track",
                "com.adobe.eventSource.requestContent")
                .setEventData(eventData).build();

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

Define an Allow List of Event Names

🚧

Conflict

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
AdobeBranchExtension.configureEventAllowList(Arrays.asList("VIEW"));

Define an Exclusion List of Event Names

🚧

Conflict

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
AdobeBranchExtension.configureEventExclusionList(Arrays.asList("VIEW"));

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);

이 페이지가 도움이 되었습니까?