5

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>
Daniele B
  • 19,801
  • 29
  • 115
  • 173

2 Answers2

2

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>
Adeel Javed
  • 372
  • 2
  • 11
  • Hi Adeel, I added: `` to the Android intent-filter and `` to the HTML page. It actually works (i.e. the Andoid app selection dialog shows up) when sharing it through the Facebook chat and clicking on it from the Android Facebook Messenger app. But if I share it to my Facebook profile timeline, and I click on it from the Android Facebook app, the HTML page opens without showing the Android app selection dialog. Are you actually able to make it work on the Facebook Android app? – Daniele B Jan 14 '17 at 19:05
  • @DanieleB yes i opened my app through Facebook app, you have to add meta tags on each page that you want to open from Facebook. – Adeel Javed Jan 16 '17 at 05:36
  • unfortunately it doesn't work with the Facebook app, so I am still trying to find the solution – Daniele B Jan 16 '17 at 19:59
  • @DanieleB have you added the meta tags on the web page that you are sharing on your facebook timeline if so than make sure that you have checked the deep linking option in the facebook developers app setting – Adeel Javed Jan 16 '17 at 20:09
  • I think I have added the tags correctly? https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Ftrenit.info%2FL2o Do I also need to set deep linking in the Facebook Developers App Settings? I can't seem to find any setting like that – Daniele B Jan 16 '17 at 22:59
  • @DanieleB check this screen shot (http://www.awesomescreenshot.com/image/2065022/2bd7074158fe42f71142a6f1cb692a23) In your Facebook developer app, Go to Settings -> Basic -> find android platform ( you already added this) Checked the single sign on button and you will see deep linking option than checked that option as well – Adeel Javed Jan 17 '17 at 04:32
  • Hi Adeel, I actually don't integrate Facebook SDK in my Android app and i don't need Single Sign On Login. Are you sure I need to set this ON even if i don't use it? – Daniele B Jan 18 '17 at 20:07
0

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>
Sri Kanth
  • 311
  • 4
  • 18