Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Mỗi tuyên bố được thiết kế cho người tiêu dùng; tuyên bố của người tiêu dùng là người đọc và xác minh tuyên bố do người uỷ quyền đưa ra, sau đó hành động dựa trên tuyên bố đó. Cụ thể hơn, người tiêu dùng thực hiện những bước cơ bản sau:
Yêu cầu danh sách bảng sao kê từ một người dùng cụ thể
Kiểm tra xem danh sách có chứa một tuyên bố nào đối với một mục tiêu nhất định hay không
Xác thực rằng mục tiêu trong câu lệnh là mục tiêu (trang web hoặc ứng dụng) mà bạn nghĩ là mục tiêu đó
Thực hiện hành động được chỉ định bởi câu lệnh nếu bạn chọn
Nhiều trường hợp sử dụng sử dụng câu lệnh cho bạn đằng sau. Ví dụ: tính năng Liên kết ứng dụng Android sử dụng các tuyên bố quyền liên kết do một trang web đưa ra để cho phép truy cập trực tiếp đường liên kết vào một ứng dụng. Một ứng dụng cho biết rằng ứng dụng đồng ý là mục tiêu của những câu lệnh như vậy bằng cách thêm mã đặc biệt (trình xử lý ý định) vào tệp kê khai.
Bạn có thể thực hiện bước 1 và 2 ở trên – yêu cầu và xác thực một câu lệnh – theo hai cách: sử dụng API của chúng tôi hoặc theo cách thủ công (sử dụng cách triển khai của riêng bạn).
Sử dụng câu lệnh bằng Digital Asset Links API (API Đường liên kết đến tài sản kỹ thuật số)
Digital Asset Links API (API Đường liên kết đến tài sản kỹ thuật số) hỗ trợ 2 phương thức: Check() và List() để tìm hoặc xác thực tuyên bố:
Check() lấy nguồn, mục tiêu và mối quan hệ, đồng thời xác minh rằng nguồn đó đưa ra tuyên bố đã gửi về mục tiêu.
List() liệt kê tất cả câu lệnh do một nguồn nhất định đưa ra.
Sử dụng câu lệnh theo cách thủ công
Giao thức Digital Asset Links (Đường liên kết đến tài sản kỹ thuật số) đang mở nên bạn có thể tự triển khai.
Để sử dụng các câu lệnh do trang web đưa ra, bạn có thể tạo yêu cầu HTTP GET cho danh sách câu lệnh tương ứng và tự phân tích cú pháp. Ví dụ: danh sách câu lệnh tương ứng cho trang web http://example.digitalassetlinks.org là tại http://example.digitalassetlinks.org/.well-known/assetlinks.json.
Để sử dụng các câu lệnh do ứng dụng Android đưa ra, bạn cần truy cập vào tệp kê khai của gói APK tương ứng. Trên thiết bị Android, bạn có thể thực hiện việc này bằng cách sử dụng giao diện PackageManager.
Vui lòng đặc biệt chú ý đến ý nghĩa cụ thể của các câu lệnh của Digital Asset Links (Đường liên kết đến tài sản kỹ thuật số). Hãy tham khảo Quy cách về đường liên kết đến tài sản nếu bạn không chắc chắn.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2024-06-26 UTC."],[[["\u003cp\u003eDigital Asset Links enable websites and apps to make statements about their relationships, which other apps and services can then verify and act upon.\u003c/p\u003e\n"],["\u003cp\u003eYou can consume these statements using the Digital Asset Links API (\u003ccode\u003eCheck()\u003c/code\u003e and \u003ccode\u003eList()\u003c/code\u003e methods) or manually by retrieving and parsing the statement list.\u003c/p\u003e\n"],["\u003cp\u003eBefore implementing your own solution, check if existing mechanisms like Android App Linking already handle your desired scenario.\u003c/p\u003e\n"],["\u003cp\u003eWebsites publish their statements in a JSON file located at \u003ccode\u003e.well-known/assetlinks.json\u003c/code\u003e, while Android app statements are found within their manifest file.\u003c/p\u003e\n"],["\u003cp\u003eFor a deeper understanding of statement meanings and the underlying protocol, refer to the Asset Links Specification.\u003c/p\u003e\n"]]],[],null,["# Consuming a statement\n\nEvery statement is designed with a *consumer* in mind; the statement consumer is the one who reads and verifies a statement made by a principal, then takes action based on that statement. More specifically, a consumer performs these basic steps:\n\n1. Request the statement list from a specific principal\n2. Check to see if the list contains a given statement against a given target\n3. Validate that the target in the statement is the target (website or app) that you think it is\n4. Perform the action specified by the statement, if you choose to\n\n[Many use cases](/digital-asset-links/v1/using) consume statements for you behind the scenes. For example, Android App Linking consumes link permission statements made by a website to enable links directly into an app. An app indicates that it agrees to be a target to any such statements by adding special code (an intent handler) in its manifest.\n| Be sure to check that your scenario doesn't have a special mechanism for consuming or implementing a statement before handling it manually.\n\nYou can perform steps 1 and 2 above --- requesting and validating a statement --- in two ways: using our API or manually (using your own implementation).\n\nConsuming statements using the Digital Asset Links API\n------------------------------------------------------\n\n**The Digital Asset Links API** supports two methods: `Check()` and `List()` to find or validate statements:\n\n- [Check()](/digital-asset-links/reference/rest) takes a source, target, and relationship and verifies that the source makes the submitted statement about the target.\n- [List()](/digital-asset-links/reference/rest) lists all statements made by a given source.\n\n| In order to use the API, you need an [API key](https://support.google.com/googleapi/answer/6158862) and you must first activate the API for your project. To do that, follow these steps:\n|\n| 1. Go to the [Google Developers Console](https://console.developers.google.com/project/_/apiui/apiview/digitalassetlinks/overview).\n|\n| The console might require you to sign in first.\n| 2. Select or create a project.If you have multiple projects, make sure that you are in the project for which you want to activate the Digital Asset Links API and click **Continue** . Or, if you do not have a project, select **Create a new project** and click **Create**.\n|\n| 3. In the Digital Asset Links API overview, click **Enable API** .\n|\n| If the API is already enabled for your project, you will see **Disable API**.\n| 4. In the left-hand menu, click on **Credentials** and either select or create an API key.\n|\n| [More information about creating API keys](https://support.google.com/googleapi/answer/6158862).\n\nConsuming statements manually\n-----------------------------\n\nThe Digital Asset Links protocol is open, so you can create an implementation of it for yourself.\n\nTo consume statements made by **web sites** , you can make an HTTP GET request for the corresponding statement list and parse it yourself. For example, the corresponding statement list for the web site `http://example.digitalassetlinks.org` is at `http://example.digitalassetlinks.org/.well-known/assetlinks.json`.\n\nTo consume statements made by **Android apps** , you need to access the manifest of the corresponding APK package. On Android devices, this can be accomplished using the [PackageManager](http://developer.android.com/reference/android/content/pm/PackageManager.html) interface.\n\nPlease pay special attention to the specific meanings of Digital Asset Links statements. Refer to the [Asset Links Specification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md) if you are unsure."]]