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.)
Related
I'd like to design a cross platform protocol that any app on mobile or app on your desktop can respond to.
On desktop the best example is torrents, where you have a magnet link of the form magnet:?urn:btih:abcabcabcabcabcabcabcabc etc. that can be opened by any app that supports the magnet: scheme. There also exists .torrent files which can be opened by anything that supports .torrents (although this won't open directly).
Is something like this possible on mobile? From my initial research it appears that iOS doesn't let multiple apps register the same uri scheme so customuniversalscheme:// won't work. I also vaguely recall mobile safari opening files in browser and not in separate apps or even being able to download the files, but i'm not sure about that anymore...
What about android? Can multiple apps respond to the same custom scheme? Files can be downloaded on android, but can files be opened directly in browser?
Is the user flow I am thinking about possible on mobile? If so, how? If not, what's the next best alternative?
So I think your comparison with the desktop torrent flow is a bit wrong. On desktop you can choose the default app to open a file or you can "Open With" an app that you want, on mobile it's a little bit different and more complicated.
So mainly on mobile platforms you open an app with a deep-link and iOS has two ways of deep-links:
the old and well known URL scheme that you defined above
the universal-link, this one is used a lot (iOS 9 and above) to forward a link, that usually will be opened in browser, to the app that responds to the universal link (it's very similar to the URL scheme thinghy)
For Android you have something similar using intent-filters and as far as I know it's possible to have multiple apps that respond to the same deep-link, but if I remember correctly the user will be prompted with an app picker (to select which app to use).
Now this is a short summary about deep-links, but from my experience the main issue with deep-links is now how you create them, it's about the app that must "forward" them. For example, on Android there are so many web browsers (not chrome) that won't forward the deep-link to the system in order to check if there is an app that can open them.
Now, if you can pass this problem, what I think you could do to unify the implementation for both platforms is to link your framework/lib/app to an API that will generate a unique deep-link scheme for every app. For example I want to "respond" to your deep-links so I register my app on your platform, with the bundle id and package name (which are unique), and your system will generate a unique combo of package name / bunde id and other number. When your lib/app/framework launch you will fetch all the configured bundles and try to fire a deep-link for each of them, this approach is kind of limited by the number of registered apps.
Android introduced the App Links with Android 6.0 Marshmallow to provide a more secure way of launching a specific app from a (https) link.
Further, I thought Android App Links covers main vulnerabilities exposed by Custom Schemes.
One of the major vulnerability is that a malicious app waiting to intercept the same URL with a similar intent filter. And then the OS will show the Ambiguous Dialog to the user to select which app to open the link.
See: Measuring the Insecurity of Mobile Deep Links of Android
The App Link URL should take the user straight to the app if the App Link has been setup properly as per the documentation for the Android AppLinks.
However, I found that this may not always be the case. For some devices, the "Ambiguous Dialog" could be shown for the first usage of the App Link URL.
Why ?
There is this strange setting called "Go to supported URLs" under the App setting -> Set as default below App Links sub heading which App Link depend upon. This setting allows the user to change the App Link behaviour. It gives three options as below.
In this app
Always ask
In other app
The strangest thing is that the default for this setting will be different from each vendors devices.
If the setting is not "In this app" then the OS will show the Ambiguous Dialog with at least your own app and browser.
Question?
Is there a way of preventing the setting being changed (prevent URL being intercepted by any other app)?
Is there a way of setting the default to 'In this app' or change the setting programatically to 'In this app' to prevent being intercepted by other apps?
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.
I use the Twitter app to follow a lot of news outlets. Each one of them posts links to articles on their websites. I want to open those articles in the news outlet's dedicated Android app. Some of them, like the NYTimes app, does it by itself. But most of them don't. I'm figuring that's because they haven't declared an intent in their app to do so. So basically I want to write an app that would give me an option to redirect the hyperlink of the article to a specific app, and I want to do it for multiple apps. Would it be possible to create a regex that would run on the URL and redirect it to the proper app accordingly?
Would it be possible to create a regex that would run on the URL
That is impossible to state in the abstract. Android's <intent-filter> system does not allow for filtering on all parts of a URL.
and redirect it to the proper app accordingly?
That is impossible to state in the abstract:
There is no requirement for the app for a news site to have any means for outside apps to tell it what to view
There is no requirement for an app's developers to document how to convert a Web site URL to whatever input would be available to tell the app to go view something
So, what you want may be possible for some news apps, but the details would vary by app.
Not that I am aware of - though this is an interesting concept.
Here are some things to know:
the twitter app doesn't care how the intent is resolved. the purpose of the intent is to share external data. once the twitter app has handed over the intent with the url it is up to the android system to decide which app can resolve.
the NY Times app is capable of opening because of this feature: https://developer.android.com/training/app-indexing/deep-linking.html
Workaround:
Learn to develop your own Android ROM to modify the Android Open Source Project adding your logic for intent resolution, compile and get your new Android ROM ready for deploy, install ROM on phone, keep your fingers crossed the entire time.
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.