[In the Knowledge Ocean #1] Android App Links vs. iOS Universal Links
Clicking on a product link on Facebook Ads, and our Amazon app opens. How it works underlying?
Throwing back to the beginning of the April in 2024, I had a chance to start working for AMI Digital Post platform of Netcompany. Within this project, I was assigned a task to research and set up the Android App Links and iOS Universal Links for this platform. Therefore, this article is all about these features for two well-known mobile operating systems.
Disclaimer: At the time I wrote this article, I was not a mobile developer or worked anything related to mobile development. Therefore, my point of view was from a web developer as well as a normal mobile user when approaching these features.
Why users need App Links or Universal Links
As always starting with the Why, let me ask you a question.
Is there any specific time using smartphone, you might have to open a commercial link from Facebook that redirects to your e-commerce marketplace such as Amazon?
I believe most of the people had this experience. And absolutely, you might be redirected to the marketplace website or even opening your Amazon application and view your desired product to buy.
To enhance the user experience in this process, Google introduced App Links for Android and on the other side, Apple had its own one for iOS with Universal Links.
Let’s start with Android App Links
By implementing Android App Links, you can directly take users to specific content within your app, bypassing the app-selection dialog. This seamless integration with your website ensures that even users without your app installed can access the desired content effortlessly. It improves the user experience, boosts engagement, and provides a consistent interaction across platforms.
But first, let’s understand the types of links since Google offers us three types of them.
Deep links
Deep links are URIs of any scheme that take users directly to a specific part of your app. However, when the user clicks a deep link, a disambiguation dialog might appear. This dialog allows the user to select one of multiple apps, including your app, that can handle the given deep link.
Web links
Web links, which utilize the HTTP and HTTPS schemes, function as deep links. In Android 12 and newer versions, when a web link is clicked (excluding Android App Links), the content is consistently displayed in a web browser. However, on earlier Android versions, if the user's device has your app or other apps capable of handling the web link, they may not be directed straight to the browser. Instead, they will encounter a disambiguation dialog akin to the one depicted in figure 2.
Android App Links
Android App Links, supported from Android 6.0 (API level 23) onwards, comprise web links utilizing the HTTP and HTTPS schemes, along with the autoVerify attribute. This attribute enables your app to establish itself as the default handler for specific types of links. Consequently, when a user clicks on an Android App Link and your app is installed, it opens instantly without displaying the disambiguation dialog.
Should users desire to change the default handler setting, they retain the option to override this behavior via the app's settings.
So, what is the actual benefits that Android App Links bring?
Enhanced security and exclusivity: Android App Links utilize HTTP URLs that are linked to your own website domain, ensuring that no other app can utilize these links. One of the prerequisites for Android App Links is the verification of domain ownership through our designated website association methods.
Seamless and uninterrupted user experience: By employing a single HTTP URL for both your website and app content, Android App Links ensure that users without the app installed are seamlessly directed to your website instead of encountering 404 errors or other issues.
Support for Android Instant Apps: Android Instant Apps enable users to access your Android app without the need for installation.
Engage users directly from Google Search: By clicking on a URL provided by Google in a mobile browser, the Google Search app, screen search on Android, or through Google Assistant, users can instantly access specific content within your app.
Cool! Now it’s time to get into iOS Universal Links
The purpose of iOS Universal Links is not different much from Android App Links. However, the setup varies.
Universal links enable seamless access to specific content within your app. By tapping or clicking on a universal link, users are directly directed to your app without any intermediary involvement of Safari or your website. Moreover, as universal links utilize standard HTTP or HTTPS links, a single URL serves both your website and app. If the app is not installed, the system automatically opens the URL in Safari, allowing your website to handle it. When users install your app, the system verifies the association between your website and app by checking a file stored on your web server. This file can only be stored by you, ensuring the security of the website-app connection.
To support Universal Links in your app, there are two steps.
Associated domains
The concept of associated domains establishes a secure connection between domains and your app, enabling the sharing of credentials and the provision of app features from your website. For instance, an online retailer may offer an accompanying app that enhances the user experience of their website.
Shared web credentials, universal links, Handoff, and App Clips all rely on associated domains. These associated domains serve as the foundation for universal links, a functionality that allows an app to display content instead of, or alongside, its corresponding website. Users who haven't downloaded the app can access the same information through a web browser instead of the native app.
To associate a website with your app, you must have the associated domain file on your website and the appropriate entitlement within your app. The apps listed in the apple-app-site-association file on your website must possess a matching Associated Domains Entitlement.
How it works?
When a user installs your app, the system attempts to download the associated domain file and verify the domains in your entitlement.
In order to incorporate the associated domain file into your website, generate a file named apple-app-site-association (without any file extension). Within this file, modify the JSON code to reflect the services supported on your domain. When dealing with universal links, ensure that you include the app identifiers for your domain under the applinks service. Likewise, if you have developed an App Clip, make sure to list the app identifier for your App Clip using the appclips service.
{
"applinks": {
"details": [
{
"appIDs": ["ABCDE12345.com.example.app"],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL with a fragment that equals no_universal_links and instructs the system not to open it as a universal link."
},
{
"/": "/buy/*",
"comment": "Matches any URL with a path that starts with /buy/."
}
]
},
"webcredentials": {
"apps": [ "ABCDE12345.com.example.app" ]
},
"appclips": {
"apps": ["ABCED12345.com.example.MyApp.Clip"]
}
}
After you construct the association file, place it in your site’s .well-known directory. The file’s URL should match the following format:
https://<fully qualified domain>/.well-known/apple-app-site-association
You must host the file using https:// with a valid certificate and with no redirects.
Update your app delegate to respond to a universal link
When the system opens your app as the result of a universal link, your app receives an NSUserActivity object with an activityType value of NSUserActivityTypeBrowsingWeb. The activity object’s webpageURL property contains the HTTP or HTTPS URL that the user accesses. Use NSURLComponents APIs to extract the components of the URL. See the examples.
What are the differences?
So, you may ask a question.
Are there any key takeaways that distinguishes two features of those platforms?
Here they are.
Platform: Android App Links are specific to the Android platform, while iOS Universal Links are specific to iOS devices.
Implementation: Android App Links require the use of HTTP URLs and the verification of domain ownership through website association methods. In contrast, iOS Universal Links utilize standard HTTP or HTTPS links and require the creation of an apple-app-site-association file on the website.
App Installation: Android App Links provide a fallback mechanism where if the app is not installed, the URL can be opened in a web browser. On the other hand, iOS Universal Links automatically open the app if it is installed or redirect to the website if the app is not installed.
Associated Domains: iOS Universal Links rely on the concept of associated domains to establish a secure association between domains and the app. This allows the sharing of credentials or providing features in the app from the website.
Configuration: Android App Links require specific intent filters to be set up in the app's manifest file. iOS Universal Links require the creation of a JSON file (apple-app-site-association) on the website with the appropriate entitlements in the app.
Last thoughts
To sum up, Android App Links and iOS Universal Links are mechanisms used to enable deep linking within mobile apps. While they serve a similar purpose, there are notable differences in their implementation and behavior.
No matter which mechanism you are using on which scenario, the ultimate purpose is to provide a seamless user experience.
Reference
Allowing apps and websites to link to your content | Apple Developer Documentation