1

I have implemented iOS and Android SDK, now I am testing my app configuration in test environment. While everything works fine with iOS, I noticed that with Android, events are not passed to Amplitude. I expect to see the [Branch] OPEN event in Amplitude. I registered Amplitude API Key in Branch settings and its status is enabled. In the Liveview section I see my Android events. What am I doing wrong? Please help me understand. Branch App ID: 705693665045009364

Build.Gradle:

buildTypes {
    release {
        ...
        manifestPlaceholders = [
                deeplinkDefaultDomain   : "faceter.app.link",
                deeplinkAlternateDomain : "faceter-alternate.app.link",
                isBranchSdkInTestMode   : false
        ]
    }
    beta {
        ...
        initWith release
        debuggable true
        applicationIdSuffix ".beta"
        manifestPlaceholders = [
                deeplinkDefaultDomain  : "faceter.test-app.link",
                deeplinkAlternateDomain: "faceter-alternate.test-app.link",
                isBranchSdkInTestMode  : true
        ]
    }
}

// Branch
implementation 'io.branch.sdk.android:library:4.+'

// required if your app is in the Google Play Storede
implementation 'com.google.firebase:firebase-appindexing:19.0.0'
implementation 'com.google.android.gms:play-services-ads:9+'

Manifest file

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
    android:name=".FaceterApplication"
    android:allowBackup="true"
    android:icon="${appIcon}"
    android:label="${appName}${appNameSuffix}"
    android:theme="@style/AppTheme.NoActionBar"
    tools:replace="android:theme, android:icon, android:label">
    
    <activity
        android:name=".core.auth.silentsignin.SilentSignInActivity"
        android:launchMode="singleTask"
        android:screenOrientation="${orientationPortrait}"
        android:theme="@style/AppTheme.Main.Light">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Branch URI scheme -->
        <intent-filter>
            <data android:scheme="faceter" android:autoVerify="true"/>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

        <!-- Branch App Links (optional) -->
        <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="https" android:host="${deeplinkDefaultDomain}" />
            <data android:scheme="https" android:host="${deeplinkAlternateDomain}" />
        </intent-filter>

    </activity>


    <!-- Branch init -->
    <meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_glKr9dT4h********ojrBm0ZDsA" />
    <meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_iaRt3lH2f********xwkhdDva41ABi" />

    <!-- Branch testing (TestMode "true" to simulate fresh installs on dev environment) -->
    <meta-data android:name="io.branch.sdk.TestMode" android:value="${isBranchSdkInTestMode}" />

    <!-- Branch install referrer tracking -->
    <receiver android:name="io.branch.referral.InstallListener" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

</application>

Application file

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

    // Branch logging for debugging
    Branch.enableDebugMode();

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

}

SilentSignInActivity.java

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

    Branch.getInstance().setRequestMetadata("$amplitude_device_id", Amplitude.getInstance().getDeviceId());

    Branch.getInstance().initSession(new Branch.BranchReferralInitListener() {
        @Override
        public void onInitFinished(JSONObject referringParams, BranchError error) {
            if (error == null) {
                Timber.i("BRANCH SDK: %s", referringParams.toString());
                // 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
            } else {
                Timber.i("BRANCH SDK: %s", error.getMessage());
            }
        }
    }, this.getIntent().getData(), this);

    BranchUtil.isDebugEnabled();
    Branch.enableLogging();
}

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

Amplitude API Key entered

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
  • Responded to your ticket sent to Branch Support. Please followup over there. Also, it is advised not to share the Branch App ID on public platforms. – AniV Oct 10 '19 at 20:24
  • 1
    How did you solve the issue ? – Ben-J Aug 25 '20 at 14:17

0 Answers0