Simon Schubert
Simon Schubert

Reputation: 2028

Deeplink opened from Facebook App goes to PlayStore

The deeplinking works fine from WhatsApp, Slack and even Facebook Messenger but doesn't work from the Facebook App itself.

In the branch.io Link Settings I did enable:

Facebook developer settings:

Android App Versions:

Example link: sharing.kptncook.com/pIbQ/FKktug85TE

Activity part of Manifest:

    <activity android:name=".MainActivity"
              android:launchMode="singleTask">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

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

        <intent-filter>
            <data android:scheme="kptncook" android:host="open" />
            <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="sharing.kptncook.com" />
            <data android:scheme="http" android:host="sharing.kptncook.com" />
        </intent-filter>
    </activity>

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

Activity:

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public void onStart() {
    super.onStart();
    Branch branch = Branch.getInstance();

    branch.initSession(new Branch.BranchReferralInitListener(){
        @Override
        public void onInitFinished(JSONObject referringParams, BranchError error) {
        }
    }, this.getIntent().getData(), this);
}

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

}

Additional info: In the emulator some links won't open and some does. If I send a link that doesn't work from the emulator to a real device it works on the real device.

What am I doing wrong?

Update: New shared links work now on the Real device in both Facebook Messenger and Main App. But if I open the exact same link in the messenger on an emulator it redirects to "r31v.test-app.link..." and doesn't show anything except a toast "Can't load page". It's so frustrating. Any ideas how to debug it?

Upvotes: 1

Views: 1465

Answers (1)

Alex Bauer
Alex Bauer

Reputation: 13613

Alex from Branch.io here:

Facebook deep linking is one of the hardest things to debug — they intentionally don't want users to leave their app, wherever possible.

A few notes for debugging:

  1. The domain r31v.test-app.link is your original link domain. You customized this to sharing.kptncook.com, but there are times when Branch needs to use both to handle certain edge cases. You need to add the following lines to your Manifest:

    <data android:scheme="https" android:host="r31v.test-app.link" /> <data android:scheme="https" android:host="r31v-alternate.test-app.link" />

  2. Other than the above, your in-app configuration implementation looks fine.

  3. It's possible something is funky with your Dashboard configuration. Branch has separate Test and Live environments, and you're currently using the Test one. It's important to make sure you haven't split your implementation between values from both sides.
  4. Deep linking behavior frequently doesn't work correctly in the emulators. It's always best to test with real devices, because results from emulators are usually not reliable.
  5. Facebook sometimes caches the App Links tags, which means you may get unpredictable results when opening a URL that has just been shared, or when re-sharing a URL that has been posted before with different data.

Feel free to reach out to our Integrations team any time with questions!

Upvotes: 2

Related Questions