0

I've implemented iOS and Android SDK, now I'm testing my app configuration in test environment. While with iOS everything seems working fine, I've noticed that with Android, the install event is correctly attributed to my quick link, any other events I'm sending (even thos I can correctly see them in the liveview) are not attributed to the quick link used to open the app.

Here my dependencies:

com.android.tools.build:gradle:3.1.1 
com.google.gms:google-services:4.2.0 
io.fabric.tools:gradle:1.31.0 
com.android.support:appcompat-v7:28.0.0 

Here the main lines of code:

@Override
protected void handleOnStart() {
    super.handleOnStart();

    Branch.enableDebugMode();

    // Branch object initialization
    Branch.getAutoInstance(this.getActivity().getApplication());

    branchInstance = Branch.getInstance();

    branchInstance.disableTracking(trackingDisabled);

    branchInstance.initSession(new Branch.BranchReferralInitListener() {
        @Override
        public void onInitFinished(JSONObject referringParams, BranchError error) {
            if (error != null) {
                log("onInitFinished - " + error.getMessage());
            } else {
                log("onInitFinished invoked with " + referringParams.toString());

                testEvent();

                // Retrieve deeplink keys from 'referringParams' and evaluate the values to determine where to route the user
                // Check '+clicked_branch_link' before deciding whether to use your Branch routing logic
            }
        }

    }, getActivity().getIntent().getData(), getActivity());
}

@Override
public void onNewIntent(Intent intent) {
    this.setIntent(intent);
}

private void testEvent() { 
    BranchEvent event = new BranchEvent(BRANCH_STANDARD_EVENT.VIEW_ITEM); 
    event.logEvent(this.getActivity()); 
} 

And my AndroidManifest.xml looks like this:

<application android:launchMode="singleTask" .....>
    <meta-data android:name="io.branch.sdk.BranchKey" android:value="@string/branchio_key_live" />
    <meta-data android:name="io.branch.sdk.BranchKey.test" android:value="@string/branchio_key_test" />
    <meta-data android:name="io.branch.sdk.TestMode" android:value="@bool/branchio_test_mode" />

    <receiver android:enabled="@bool/branchio_track_referral_active" android:name="io.branch.referral.InstallListener" android:exported="true">
      <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
      </intent-filter>
    </receiver>
</application>
Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
Bagbyte
  • 845
  • 2
  • 18
  • 34

1 Answers1

0

It looks like your code is slightly different than what we recommend in our Android Docs, so I would recommend you conform your code as closely as possible to our code snippets as possible. For example, we recommend initializing in the onStart() method whereas you are doing yours in handleOnStart(). Here are the Android docs: https://docs.branch.io/apps/android/

If you do this and are still having difficulties, please send an email to support@branch.io and provide your App ID which is found in your Account Settings on your dashboard so we can investigate this further.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343