How to deep link an app from the Facebook App builtin browser? - android

I have a link that when clicked loads a dynamic webpage (which performs some operations on the server), and then redirect the user to an installed app. So far, opening the link in the following apps/browsers works fine:
Android's default browser;
Chrome - several versions
Twitter app
Something similar is also being done on iOS, and works fine.
The following does not work, no matter what I try:
Sharing the link on Facebook, and opening it from the Facebook App with Facebook's builtin browser on Android (on iOS this works fine). I get an error saying "Page can't be loaded".
What has been done/tried:
The app has the needed content filters and intent setup correctly, and the filters were set to handle both a custom protocol scheme ("example://") and HTTP ("http", "example.com") - one at a time and both at the same time.
Using App Links tags or Open Graph tags (as suggested by some FB literature) did not solve the problem.
Redirecting the user with an HTTP redirect, javascript or meta refresh tag does not work.
Using an HTML link and taping it does not work.
All of those methods work everywhere except when using the Android Facebook App's builtin browser.
(this was tested with several Android versions, 2.3, 4.4 and 5.0)
Is there any special syntax for this kind of links to work?
Thanks,
Jean

Have you tried changing your site's redirect implementation?
https://developer.chrome.com/multidevice/android/intents
The functionality has changed slightly in Chrome for Android, versions
25 and later. It is no longer possible to launch an Android app by
setting an iframe's src attribute. For example, navigating an iframe
to a URI with a custom scheme such as paulsawesomeapp:// will not work
even if the user has the appropriate app installed. Instead, you
should implement a user gesture to launch the app via a custom scheme,
or use the “intent:” syntax described in this article.

Related

Android react-native deep linking and application embedded browser

I have a react-native application which use deep linking for Android.
Basically I have a working setup, which means that when im testing on a real device if I go to my website page displaying a link mapped by the AndroidManifest.xml, my app is correctly opening when clicking on the link. Same thing when I'm clicking the mapped link directly from Gmail app or Slack, everything works correctly.
However, when I'm going to my website page (which is displaying the mapped link) from the "embedded" Gmail or Slack browser and clicking on the link, the deep link doesn't work and it redirects on the web directly without asking to open the app first.
It seems a strange behaviour for me and after some research I wasn't able to find an explanation or a solution, so anyone have an idea on how to handle this ?
Thank you for your time.

How to prevent Chrome from opening App Links

I have an android application say Sample App. I want to add App Links according to Android Developer Guide. I was successful in implementing them, but there was an problem with Chrome. When I access the corresponding Sample Web App and there is <a> tag with href="https://www.sample.com/profile" and it's also supported by App, it opens in app instead of continuing in Chrome.
I checked documentation and it is supposed to be default behavior of Chrome. But then I came across Linkedin app. The My Network tab they have when clicked in browser continues in browser but same link if I save to docs or any other application and click it then it opens in native app.
I want to know how this is done?
I believe this is because, as you said, the standard deep linking behavior is to route to the app if it is installed. This behavior is handed-off immediately when the link is clicked because your app overriders that url to be handled by app instead of Chrome.
First, I believe that you should route users to your application because its a better, more engaging experience, presumably.
If you are convinced, then I would change your manifest to strictly handle links that you want to handle. See this post to see how to handle only certain links.

Android Deep Link Web Fallback

I've enabled Deep Linking and also created the association.json in the .well-known Folder.
When clicking on a URL the App opens the related content.
I've a button in my App to open the Content in a Web Browser. But opening the link again with a VIEW intent it opens again the App.
I saw that I could try to set the com.android.chrome Package in the Intent, but this is not a clean solutions because some Android users may use an alternative Browser.
How can I do this correctly?
I assume it works fine for you with other browsers.
Google has modified the way chrome browser handles intent, in Android 25 or later. It is no longer possible to launch an Android app by setting an iframe's src attribute.
Checkout following link:
https://developer.chrome.com/multidevice/android/intents

Avoid showing android app chooser when source and target domains are same in http url

I am working on adding support for http urls in my android app, but am facing a weird situation. I have an android app and a website and want both of these to support the same http urls. As a standard practice whenever a supported linked is clicked android shows the appChooser dialog to select an app to proceed (prior to Android M). This behaviour is fine when the user is coming from a different channel other than your own website. I do not want this appChooser dialog to be displayed if the user is already browsing my website on chrome and clicks on a link which is supported by app. Since he is already on my website on chrome I want him to go forward without any interruption.
Let me explain this with an example:
I have added support for http://www.mywebsite.com/xyz [1] in my android app
User opens http://www.mywebsite.com [2] on chrome then clicks on link [1] present on the page. In this case I want the chrome to load the url without showing the appChooser dialog.
Unfortunately, the default android behaviour looks to be showing the appChooser dialog irrespective from where the link is clicked.
Is there anyway I can achieve my desired behaviour?
I see that LinkedIn and Facebook have achieved this behaviour, but not able to figure out how.
I dig into chromium source to figure out what is happening. As per chrome implementation when navigating within the same host it will show an Intent App Chooser if there is a newer App available to handle the target url as compared to the apps which can handle the source/referrer url. Source Code Link - https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java?q=browser_fallback_url&sq=package:chromium&l=385
Above explains the feature behavior that I am seeing. Since http://www.mywebsite.com is not handled by app, when user clicks on any link present on this page which is also handled by the app, it shows the app chooser.

iOS custom URL schemes vs. Universal Links and Android counterpart

I'm looking for functionality where when a user receives a message - let's say through the WhatsApp app - containing a link starting with a certain scheme (prefix), my app will be invoked when the user taps on that link.
I understand that this feature is already available as "custom URL schemes" but I also noticed now that Universal Links have a similar thing. So, is there any issue with "custom URL schemes"? I don't want to use Universal Links because I don't want my app to be restricted to iOS 9.
Moreover, it looks like Android also has this feature of customer URL, but again, on the latest Android version 6.0, it's mentioned here that they also have "App Links" feature which only works on Android 6.0. So, again, what is the difference between the two?
I don't want to restrict my app to work on only iOS9 or Android 9. So I guess the traditional "custom URL schemes" is more attractive for me for the time being.
Also, I want to make sure that "custom URL schemes" will work when a user taps on a link on WhatsApp or it will only work if the link on the web browser or mail.
URLs with custom schemes don't get displayed as links in many Android applications (SMS, E-Mail, WhatsApp, Hangouts, you name it), which de facto make them unopenable by your application. iOS however does not allow for defining scheme + host + path like android does.
One possible (hacky) solution to this is browser sniffing (I know, evil, but so are non-standard extensions to well-defined behavior, especially if nothing was broken in the first place) at the resource you expose over a URL reachable over HTTP(s).
You could check if the request origins from the iOS-platform you offer native apps for; then you would have to make sure that the device has your application installed (this is getting uglier and uglier; see here for example) and then, only then redirect to yourapp://the-rest-of-your/uri, which causes a prompt shown to the user whether they want to open the address inside the application or not. (Tested on an iPhone 4 with iOS 8, Safari browser.)

Categories

Resources