Facebook on Android: target app doesn't open when clicking on link

1.6k views Asked by At

I included the proper app links metatags in the HTML, so that by clicking on that link on Facebook the Android and iOS apps would open with the correct content.

This is an example of page: https://trenit.info/L2o

<meta property="al:ios:url" content="https://trenit.info/L2o" />
<meta property="al:ios:app_store_id" content="1058908183" />
<meta property="al:ios:app_name" content="Trenit!" />
<meta property="al:android:url" content="https://trenit.info/L2o" />
<meta property="al:android:app_name" content="Trenit!" />
<meta property="al:android:package" content="eu.baroncelli.oraritrenitalia" />

I published that link on Facebook, and I have installed the Trenìt! app in both my Android and iOS devices.

on iOS:
if I use the Facebook app and click on that link, the Trenìt! iOS app opens correctly with that content.

on Android:
If I use the Facebook app and click on that link, the HTML page opens instead of the Trenìt! Android app.

am I doing something wrong?

Please note, on the Android manifest I have already specified this 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="https" android:host="trenit.info" />
        </intent-filter>
2

There are 2 answers

1
Sri Kanth On

In android to open your app from external link/sms.., you have to use deep link in your app. so that your app will be shown in the choose launcher dialog, where you can choose your app to open
Please follow below developers link
https://developer.android.com/training/app-indexing/deep-linking.html

This below xml is just for understanding. Please change accordingly

<activity android:name="--YourActivityName--" android:label="--your app lable--" > <intent-filter android:label="@string/filter_title"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- Accepts URIs that begin with "https://trenit.info/L2o” --> <data android:scheme="https" android:host="trenit.info" android:pathPrefix="/L2o" /> </intent-filter> </activity>
7
Adeel Javed On

I have recently implemented same functionality in my app and it's working correctly.

As per Facebook documentation your tags in the website page are not correct, for android it should be like this

<meta property="al:android:url" content="trenit://L2o/*" />
<meta property="al:android:app_name" content="Trenit!" />
<meta property="al:android:package" content="eu.baroncelli.oraritrenitalia" />

and in your manifest it should be like this

       <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="trenit" />
        </intent-filter>