Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release thay vì aosp-main để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Đồng bộ hoá thanh toán không qua máy chủ lưu trữ NFC
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.
Android hỗ trợ mô phỏng thẻ NFC bằng một phần tử bảo mật để mô phỏng thẻ bên ngoài máy chủ. (Để biết thêm thông tin, hãy xem phần Tổng quan về mô phỏng thẻ dựa trên máy chủ.)
Tuy nhiên, trên nền tảng Android, dịch vụ thanh toán ưu tiên được chỉ định trong chế độ cài đặt Chạm và thanh toán không phải lúc nào cũng đồng bộ hoá với ứng dụng trong phần tử bảo mật. Điều này có nghĩa là có thể một dịch vụ thanh toán không ưu tiên trong phần tử bảo mật sẽ được sử dụng thay vì dịch vụ thanh toán ưu tiên.
Trong Android 11, tính năng đồng bộ hoá thanh toán ngoài máy chủ cung cấp một cơ chế cho phép bạn đồng bộ hoá cấu hình thanh toán trong tính năng Chạm và thanh toán, cấu hình định tuyến trên giao diện người dùng không tiếp xúc (CLF) và trạng thái do ứng dụng chọn trong phần tử bảo mật.
Sơ đồ sau đây minh hoạ cấu trúc thiết kế của tính năng đồng bộ hoá thanh toán bên ngoài máy chủ lưu trữ.
Hình 1. Cấu trúc thiết kế đồng bộ hoá thanh toán không qua máy chủ lưu trữ
Triển khai
Để triển khai tính năng đồng bộ hoá thanh toán ngoài máy chủ, thiết bị phải có trình điều khiển NFC hỗ trợ tiêu chuẩn NCI 2.0 và phải sử dụng khung NFC Dự án nguồn mở Android và Giao diện lập trình ứng dụng di động mở (OMAPI).
API khung
Để triển khai tính năng đồng bộ hoá thanh toán ngoài máy chủ, hãy sử dụng các API khung sau đây có trong Dự án nguồn mở Android:
Để xác thực việc triển khai tính năng đồng bộ hoá thanh toán ngoài máy chủ, hãy cài đặt các ứng dụng phần tử bảo mật có phần tử bảo mật tương ứng, sau đó kiểm tra phản hồi thích hợp từ đầu đọc NFC trong nhiều điều kiện.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["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: 2025-07-27 UTC."],[],[],null,["# NFC off-host payment synchronization\n\nAndroid supports NFC card emulation with a secure element for off-host card\nemulation. (For more information, see\n[Host-based card emulation overview](https://developer.android.com/guide/topics/connectivity/nfc/hce).)\nHowever, on the Android platform, the preferred payment service specified in the\nTap \\& pay setting isn't always synchronized with the app in the secure\nelement. This means it's possible that a nonpreferred payment service in the\nsecure element is used instead of the preferred payment service.\n\nIn Android 11, the *off-host payment synchronization*\nfeature provides a mechanism that lets you synchronize the payment\nconfiguration in Tap \\& pay, the routing configuration on the contactless\nfrontend (CLF), and the app-selected state in the secure element.\n\nThe following diagram illustrates the design architecture of the off-host\npayment synchronization feature.\n**Figure 1.** Off host payment synchronization design architecture\n\nImplementation\n--------------\n\nTo implement the off-host payment synchronization feature, the device must have\nan NFC controller that supports the NCI 2.0 standard and must use the Android\nOpen Source Project NFC and Open Mobile Application Programming Interface\n(OMAPI) frameworks.\n\n### Framework APIs\n\nTo implement off-host payment synchronization, use the following framework APIs\nfound in the Android Open Source Project:\n\n- [`getAidsForPreferredPaymentService()`](https://developer.android.com/reference/android/nfc/cardemulation/CardEmulation#getAidsForPreferredPaymentService()): Retrieves the registered AIDs for the preferred payment service.\n- [`getRouteDestinationForPreferredPaymentService()`](https://developer.android.com/reference/android/nfc/cardemulation/CardEmulation#getDescriptionForPreferredPaymentService()): Retrieves the route destination for the preferred payment service.\n- [`getDescriptionForPreferredPaymentService()`](https://developer.android.com/reference/android/nfc/cardemulation/CardEmulation#getRouteDestinationForPreferredPaymentService()): Returns a user-visible description of the preferred payment service.\n- [`android.permission.NFC_PREFERRED_PAYMENT_INFO`](https://developer.android.com/reference/android/Manifest.permission#NFC_PREFERRED_PAYMENT_INFO) (permission): Allows apps to receive NFC preferred payment service information.\n- [`android.nfc.action.PREFERRED_PAYMENT_CHANGED`](https://developer.android.com/sdk/api_diff/r-dp1/changes/android.nfc.NfcAdapter) (broadcast action): Intent to notify if the preferred payment service changed.\n\nValidation\n----------\n\nTo validate your implementation of the off-host payment synchronization feature,\ninstall secure element apps with corresponding secure elements and then check\nfor appropriate responses from an NFC reader in different conditions."]]