From 5ec00b49c85c2aad92b9100de240c82b97006062 Mon Sep 17 00:00:00 2001 From: Joe Fernandez Date: Sat, 23 May 2015 02:03:09 -0700 Subject: docs: M Preview - App Linking Change-Id: Ie6d97cd31f722be92acf93cfd540fc4284ef410c --- docs/html/preview/features/app-linking.jd | 112 ++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 docs/html/preview/features/app-linking.jd diff --git a/docs/html/preview/features/app-linking.jd b/docs/html/preview/features/app-linking.jd new file mode 100644 index 000000000000..c516f35b04c0 --- /dev/null +++ b/docs/html/preview/features/app-linking.jd @@ -0,0 +1,112 @@ +page.title=App Linking + +@jd:body + + +
+ +
+ +

+ The Android Intent system is a flexible mechanism to enable apps to handle content and requests. + Multiple apps may declare matching URI patterns in their intent filters. When a user clicks on a + web link that does not have default launch handler, the platform may show a dialog for the user + to select from a list of apps that have declared matching intent filters. +

+ +

+ The Android M Developer Preview introduces support for app linking, which improves upon existing + link handling by allowing app developers to associate an app with a web domain they own. When + developers create this association, the platform can automatically determine the default app used + to handle a particular web link and skip asking users. +

+ + +

Declare a Website Association

+ +

+ Website owners must declare associations with apps to establish an app link. The site owner + declares the relationship to an app by hosting a JSON file, named {@code statements.json}, at the + well-known location on the domain: +

+ +
http://<domain>:<optional port>/.well-known/statements.json
+ +

+ Note: + During the M Developer Preview period, the JSON file is verified via http protocol. For + the official release of the platform, the file is verified over encrypted, https protocol. +

+ +

+ This JSON file indicates the Android app that should be used as the default handler for the URLs + under this domain. It identifies the app based on these fields: +

+ + + +

+ The following file listing shows an example of the contents and format of a + {@code statements.json} file: +

+ +
+[{
+  "relation": ["delegate_permission/common.handle_all_urls"],
+  "target": {
+    "namespace": "android_app",
+    "package_name": "<package name>",
+    "sha256_cert_fingerprints": ["6C:EC:C5:0E:34:AE....EB:0C:9B"]
+  }
+}]
+
+ + + + +

+ An app can indicate to the platform to verify app links against the {@code statements.json} files + hosted on the sites defined by the host names in the <data> elements of the intent filters. + To do this, add an {@code android:autoVerify} attribute to the appropriate intent filters in the + manifest, as shown in the following manifest code snippet: +

+ +
+<activity ...>
+    <intent-filter android:autoVerify="true">
+        <action android:name="android.intent.action.VIEW" />
+        <category android:name="android.intent.category.DEFAULT" />
+        <category android:name="android.intent.category.BROWSABLE" />
+        <data android:scheme="http" android:host="www.android.com" />
+        <data android:scheme="https" android:host="www.android.com" />
+    </intent-filter>
+</activity>
+
+ +

+ When an app is installed, the platform attempts to verify the app links. If the platform cannot + successfully verify app links, it falls back to prompting the user the next time they open a link + that the app handles, or they will need to explicitly enable the app in the App Info settings UI. +

+ +

Managing App Link Settings

+ +

+ Users can change app link settings so URLs are handled the way they prefer. You can review and + manage app links in the system Settings app, under Settings > Apps > App Info > + Open by default. +

-- cgit v1.2.3-59-g8ed1b