1

EDITED:

Right now my only issue with deep linking is that whenever i click deeplink and My application is not running it will open my HomeActivity and deeplinked Activity in background. If i press back button from HomeActivity my app minimizes and when i start it again deeplink Activity gets called only then and is redirected to correct Activity.

Hello Everyone I want to implement Facebook deep linking from this reference https://developers.facebook.com/docs/app-ads/deep-linking. and i was successful with it but if my app is not running, it just redirects me to home screen when clicking deeplink from Facebook app. I can't seem to find solution to it can anyone help me out?

I have followed step by step instructions:

Created FB app Added FB sdk to Android app When I run the app, it is detected by Facebook, verified on the https://developers.facebook.com/tools/app-ads-helper/

<activity
        android:name=".activities.FacebookAdActivity"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="com.example.myapp" />
        </intent-filter>
    </activity>

1 Answers1

0

Your <data> tag in your AndroidManifest.xml should look like this -

<data android:scheme="yourScheme" android:host="com.your.package"
                    android:pathPrefix="/FacebookAdActivity"/>

In facebook provide the complete path yourScheme://com.your.package/FacebookAdActivity this should open the Ad Activity directly

Darshan Pania
  • 1,374
  • 13
  • 20
  • Thank you for answering. Right now my deeplink is opened in background whenever i click the link or test it with adb shell if my app is not running (meaning it opens my HomeActivity and DeeplinkActivity in background). if it is running it is being redirected to correct Activity, – Musical Astronaut Sep 25 '18 at 10:09
  • You are saying that your activity opens in the background? But the Activity will have a view right, it should open up as the app – Darshan Pania Sep 25 '18 at 11:40
  • I will demonstrate the flow so you can understand me better: Clicked app link from facebook app > application opens up > starts HomeActivity > Pressing Back button minimizes app and returns you where you were before that meaning back to facebook app > launch app again from Overview button makes you go to DeepLinkActivity. – Musical Astronaut Sep 25 '18 at 12:43
  • Then there is something wrong in the way you have configured your home activity to launch. Please check the Activity flags you have mentioned for your activities in your AndroidManifest.xml file – Darshan Pania Sep 26 '18 at 06:29
  • You were right. there is a redirect function and that's why it happened. thank you. – Musical Astronaut Sep 26 '18 at 07:59