Skip to content

Commit 9c81c6d

Browse files
authored
Add digital asset linking snippets (#476)
1 parent d223cb1 commit 9c81c6d

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START android_identity_assetlinks_json]
18+
[
19+
{
20+
"relation" : [
21+
"delegate_permission/common.handle_all_urls",
22+
"delegate_permission/common.get_login_creds"
23+
],
24+
"target" : {
25+
"namespace" : "android_app",
26+
"package_name" : "com.example.android",
27+
"sha256_cert_fingerprints" : [
28+
SHA_HEX_VALUE
29+
]
30+
}
31+
}
32+
]
33+
// [END android_identity_assetlinks_json]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// Enable host to permit Google to retrieve the DAL
18+
// [START android_identity_assetlinks_allow_host]
19+
User-agent: *
20+
Allow: /.well-known/
21+
// [END android_identity_assetlinks_allow_host]
22+
23+
// Manifest file addition
24+
// [START android_identity_assetlinks_manifest]
25+
<meta-data android:name="asset_statements" android:resource="@string/asset_statements" />
26+
// [END android_identity_assetlinks_manifest]
27+
28+
// Declare association in Android app
29+
// [START android_identity_assetlinks_app_association]
30+
<string name="asset_statements" translatable="false">
31+
[{
32+
\"include\": \"https://signin.example.com/.well-known/assetlinks.json\"
33+
}]
34+
</string>
35+
// [END android_identity_assetlinks_app_association]
36+
37+
// Example status code to test DAL
38+
// [START android_identity_assetlinks_curl_check]
39+
> GET /.well-known/assetlinks.json HTTP/1.1
40+
> User-Agent: curl/7.35.0
41+
> Host: signin.example.com
42+
43+
< HTTP/1.1 200 OK
44+
< Content-Type: application/json
45+
// [END android_identity_assetlinks_curl_check]

0 commit comments

Comments
 (0)