APP LINKS
Publishing App Links
Publishing App Link metadata is as simple as adding a few lines to the <head> tag in the HTML for your content. Apps that link to your content can then use this metadata to deep-link into your app, take users to an app store to download the app, or take them directly to the web to view the content. This allows developers to provide the best possible experience for their users when linking to their content.
App Links are specified using the tags defined in the registry below. Each target platform requires a different set of metadata in order to provide enough context for one app to deep-link into another.
A simple web page that provides App Link metadata might look like this:
File: documentation.html
<html>
<head>
<meta property="al:ios:url" content="applinks://docs" />
<meta property="al:ios:app_store_id" content="12345" />
<meta property="al:ios:app_name" content="App Links" />
<meta property="al:android:url" content="applinks://docs" />
<meta property="al:android:app_name" content="App Links" />
<meta property="al:android:package" content="org.applinks" />
<meta property="al:web:url"
content="http://applinks.org/documentation" />
</head>
<body>
Hello, world!
</body>
</html>
Platform Metadata Schema
The following tags can be used to define App Link metadata for your site. Each device type can be specified multiple times to accommodate multiple values, allowing you to provide a fallback list of apps to search for when navigating (e.g. if both a free and paid version of an app is available, or if multiple versions of the app exist that handle different deep-links).
Your app may also define a single fallback URL to be loaded in a web browser if your app is not installed. If your app has no equivalent web content, you may specify al:web:should_fallback as false to indicate that other apps should not attempt to fall back to displaying your content in a web browser.
Device Type: iOS | |||
---|---|---|---|
Property | Example Content | Description | Required (Y/N) |
al:ios:url | applinks://docs | A custom scheme for the iOS app | Y |
al:ios:app_store_id | 12345 | The app ID for the App Store | N |
al:ios:app_name | App Links | The name of the app (suitable for display) | N |
Device Type: iPhone | |||
Property | Example Content | Description | Required (Y/N) |
al:iphone:url | applinks://docs | A custom scheme for the iPhone app | Y |
al:iphone:app_store_id | 12345 | The app ID for the App Store | N |
al:iphone:app_name | App Links | The name of the app (suitable for display) | N |
Device Type: iPad | |||
Property | Example Content | Description | Required (Y/N) |
al:ipad:url | applinks://docs | A custom scheme for the iPad app | Y |
al:ipad:app_store_id | 12345 | The app ID for the App Store | N |
al:ipad:app_name | App Links | The name of the app (suitable for display) | N |
Device Type: Android | |||
Property | Example Content | Description | Required (Y/N) |
al:android:url | applinks://docs | A custom scheme for the Android app | N |
al:android:package | org.applinks | A fully-qualified package name for intent generation | Y |
al:android:class | org.applinks.DocsActivity | A fully-qualified Activityclass name for intent generation | N |
al:android:app_name | App Links | The name of the app (suitable for display) | N |
Device Type: Windows Phone | |||
Property | Example Content | Description | Required (Y/N) |
al:windows_phone:url | applinks://docs | A custom scheme for the Windows Phone app | Y |
al:windows_phone:app_id | a14e93aa-27c7-df11-a844-00237de2db9f | The app ID (a GUID) for app store | N |
al:windows_phone:app_name | App Links | The name of the app (suitable for display) | N |
Device Type: Windows | |||
Property | Example Content | Description | Required (Y/N) |
al:windows:url | applinks://docs | A custom scheme for the Windows app | Y |
al:windows:app_id | a14e93aa-27c7-df11-a844-00237de2db9f | The app ID (a GUID) for app store | N |
al:windows:app_name | App Links | The name of the app (suitable for display) | N |
Device Type: Universal Windows | |||
Property | Example Content | Description | Required (Y/N) |
al:windows_universal:url | applinks://docs | A custom scheme for the Windows Universal app | Y |
al:windows_universal:app_id | a14e93aa-27c7-df11-a844-00237de2db9f | The app ID (a GUID) for app store | N |
al:windows_universal:app_name | App Links | The name of the app (suitable for display) | N |
Web Fallback | |||
Property | Example Content | Description | Required (Y/N) |
al:web:url | http://applinks.org/documentation | The web URL; defaults to the URL for the content that contains this tag | N |
al:web:should_fallback | false | Indicates if the web URL should be used as a fallback; defaults to true | N |
When crawling URLs for App Link metadata, developers should send a request with al as one of the prefix values for the Prefer-Html-Meta-Tags header. Your server may choose to limit its response to only include HTML containing the tags above, and can use this as a signal to return these tags even when the response type for the given location would otherwise be something other than text/html.
Prefer-Html-Meta-Tags: al
App Link Metadata Examples
A few examples of common cases when specifying App Link metadata follows.
An app that is only available on iOS and on the web:
<html>
<head>
<meta property="al:ios:url" content="applinks://docs" />
<meta property="al:ios:app_store_id" content="12345" />
<meta property="al:ios:app_name" content="App Links" />
<!-- Other headers -->
</head>
<!-- Other HTML content -->
</html>
An app that has multiple versions on iOS, where apps following a link should attempt to use the latest version available on the device:
<html>
<head>
<meta property="al:ios" />
<meta property="al:ios:url" content="applinks_v2://docs" />
<meta property="al:ios:app_store_id" content="12345" />
<meta property="al:ios:app_name" content="App Links" />
<meta property="al:ios" />
<meta property="al:ios:url" content="applinks_v1://browse" />
<meta property="al:ios:app_name" content="App Links" />
<!-- Other headers -->
</head>
<!-- Other HTML content -->
</html>
An app with an iPad and iPhone version:
<html>
<head>
<meta property="al:iphone:url" content="applinks://docs" />
<meta property="al:iphone:app_store_id" content="12345" />
<meta property="al:iphone:app_name" content="App Links" />
<meta property="al:ipad:url" content="applinks://docs" />
<meta property="al:ipad:app_store_id" content="67890" />
<meta property="al:ipad:app_name" content="App Links" />
<!-- Other headers -->
</head>
<!-- Other HTML content -->
</html>
An app that has no web content, but has apps on iOS and Android:
<html>
<head>
<meta property="al:android:package" content="org.applinks" />
<meta property="al:android:url" content="applinks://docs" />
<meta property="al:android:app_name" content="App Links" />
<meta property="al:ios:url" content="applinks://docs" />
<meta property="al:ios:app_store_id" content="12345" />
<meta property="al:ios:app_name" content="App Links" />
<meta property="al:web:should_fallback" content="false" />
<!-- Other headers -->
</head>
<!-- Other HTML content -->
</html>
A shared link for an app whose web content may be found at another URL:
<html>
<head>
<meta property="al:android:package" content="org.applinks" />
<meta property="al:android:url" content="applinks://docs" />
<meta property="al:android:app_name" content="App Links" />
<meta property="al:ios:url" content="applinks://docs" />
<meta property="al:ios:app_store_id" content="12345" />
<meta property="al:ios:app_name" content="App Links" />
<meta property="al:web:url"
content="http://www.example.com/applinks_docs" />
<!-- Other headers -->
</head>
<!-- Other HTML content -->
</html>
UX Guidelines/Recommendations
App Links enable you to provide your users an experienced optimized for their device when viewing content. You should optimize the display of links that have App Link metadata for your app. You may choose to take a user to the native app store when the app is not installed or display the name of the app based upon the App Link metadata for a given link.
As is common when navigating to links on the web, it’s useful to give users the ability to return to apps that they came from after navigating. On some platforms, such as Android and Windows Phone, there is a built-in notion of a back button that fulfills this function.
Some platforms such as iOS, however, lack a back button. As specified in the “Navigating on iOS” section, when one app navigates to another, it may provide a referer_app_link with enough information to allow the receiving app to provide a back button for its users. We recommend that the receiver of an App Link navigation display the standard “Touch to return” UI shown in the image below when an incoming navigation contains thereferer_app_link metadata.
Implementations
Developers may choose to implement the App Links protocol for each platform themselves based upon the description above. Alternatively, developers may choose to use a library that helps them properly execute an App Link navigation, handle incoming navigations, and publish App Link metadata.
You may use the following implementations for navigating to and handling incoming App Link navigations:
- Bolts for iOS - Open-source reference implementation for iOS apps
- Bolts for Android - Open-source reference implementation for Android apps
- Rivets for C# – Rivets is a Xamarin component that lets you handle incoming and outgoing App Link navigation. It will work with the Xamarin runtime on iOS, Android or Windows Phone.
- .NET SDK from the OuterCurve foundation – The .NET SDK has functionality to add App Links support to your Windows and Windows Phone apps.
The following tools may helpful for publishers of content with App Link metadata:
- Parse App Links Cloud Code Module – Provides a simple way to publish web content with App Link metadata
- Facebook App Links Hosting API – A simple endpoint that Facebook mobile apps can use to publish App Link metadata without creating/modifying web content
Some providers may also provide access to a high-performance index of App Link metadata that you may choose to use in your own apps rather than scraping and parsing HTML yourself:
- Facebook App Link index – Provides access to Facebook’s index of App Link metadata for arbitrary URLs
Comments
Post a Comment