Hướng dẫn về khả năng kết nối
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.
Ứng dụng của bạn có thể kết nối với thế giới bên ngoài bằng nhiều công nghệ giao tiếp khác nhau, bao gồm Wi-Fi, Bluetooth và USB. Các hướng dẫn được liệt kê bên dưới đề cập đến việc thêm tính năng hỗ trợ cho các công nghệ này và tối ưu hoá ứng dụng để có khả năng kết nối.
Công nghệ được hỗ trợ
Android hỗ trợ các giao thức và khung sau đây để kết nối thiết bị của bạn với thế giới bên ngoài.
Hướng dẫn |
Mạng: Tổng quan |
Tổng quan về các hướng dẫn bao gồm việc thực hiện nhiều thao tác mạng, bao gồm cả kết nối, quản lý, phân tích cú pháp XML, giám sát và nhiều thao tác khác. |
Mạng: 5G |
Tận dụng mạng 5G. |
Mạng: VPN |
Phát triển và kiểm thử ứng dụng mạng riêng ảo (VPN) của riêng bạn cho thiết bị chạy Android. |
Mạng: Quét tìm Wi-Fi |
Lấy danh sách các điểm truy cập Wi-Fi hiển thị trên một thiết bị. |
Mạng: Wi-Fi Direct (P2P) |
Kết nối trực tiếp các thiết bị được hỗ trợ với nhau mà không cần điểm truy cập trung gian. |
Mạng: Wi-Fi Aware |
Cho phép các thiết bị chạy Android 8.0 (API cấp 26) trở lên khám phá và kết nối trực tiếp với nhau mà không cần bất kỳ loại kết nối nào khác giữa các thiết bị đó. Còn được gọi là Mạng nhận biết thiết bị lân cận (NAN). |
Mạng: Thời gian trọn vòng của Wi-Fi (RTT) |
Đo khoảng cách đến các điểm truy cập Wi-Fi có hỗ trợ RTT và các thiết bị Wi-Fi Aware ngang hàng ở gần. |
Mạng: Điểm phát sóng Wi-Fi chỉ trong cục bộ |
Cho phép các ứng dụng trên thiết bị đã kết nối với điểm phát sóng Wi-Fi giao tiếp với nhau. |
Bluetooth: Tổng quan |
Tổng quan về tính năng hỗ trợ Bluetooth trên Android, bao gồm cả kiến thức cơ bản và các lớp và giao diện chính. |
Bluetooth: Bluetooth Classic |
Thiết lập kết nối Bluetooth cơ sở trên ứng dụng. |
Bluetooth: Bluetooth năng lượng thấp (BLE) |
Chuyển một lượng nhỏ dữ liệu giữa các thiết bị ở gần và tương tác với cảm biến khoảng cách. |
Bluetooth: Âm thanh BLE |
Nhận âm thanh có độ trung thực cao mà không làm giảm thời lượng pin, đồng thời cho phép người dùng chuyển đổi liền mạch giữa các trường hợp sử dụng. |
Giao tiếp phạm vi gần (NFC) |
NFC là một tập hợp các công nghệ không dây tầm ngắn, thường yêu cầu khoảng cách từ 4 cm trở xuống để bắt đầu kết nối. |
Đo khoảng cách |
Xử lý các phiên đo khoảng cách trên nhiều công nghệ. |
Viễn thông |
Quản lý cuộc gọi âm thanh và video, bao gồm cả eSIM và thẻ SIM. |
Giao tiếp băng tần siêu rộng (UWB) |
Đo khoảng cách chính xác giữa các thiết bị. |
USB |
Sử dụng chế độ phụ kiện USB và máy chủ USB để hỗ trợ nhiều thiết bị ngoại vi USB và phụ kiện USB Android. |
Tối ưu hoá
Các hướng dẫn sau đây có thể giúp bạn tối ưu hoá ứng dụng để kết nối.
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,["# Connectivity guides\n\nYour app can connect with the outside world using a variety of different\ncommunication technologies, including Wi-Fi, Bluetooth, and USB. The guides\nlisted below cover adding support for these technologies and for optimizing\nyour app for connectivity.\n\nSupported technologies\n----------------------\n\nAndroid supports the following protocols and frameworks for connecting your\ndevice to the outside world.\n\n| Guides ||\n|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Networks: [**Overview**](/develop/connectivity/network-ops) | Overview of guides that cover performing various network operations, including connections, management, parsing XML, monitoring, and more. |\n| Networks: [**5G**](/develop/connectivity/5g/enhance-with-5g) | Take advantage of 5G networking. |\n| Networks: [**VPN**](/develop/connectivity/vpn) | Develop and test your own virtual private network (VPN) client for an Android-powered device. |\n| Networks: [**Wi-Fi scanning**](/develop/connectivity/wifi-scan) | Get a list of Wi-Fi access points visible from a device. |\n| Networks: [**Wi-Fi Direct (P2P)**](/develop/connectivity/wifip2p) | Connect supported devices directly to each other without an intermediate access point. |\n| Networks: [**Wi-Fi Aware**](/develop/connectivity/wifi-aware) | Enable devices running Android 8.0 (API level 26) and higher to discover and connect directly to each other without any other type of connectivity between them. Also known as Neighbor Awareness Networking (NAN). |\n| Networks: [**Wi-Fi Round-Trip Time (RTT)**](/develop/connectivity/wifi-rtt) | Measure the distance to nearby RTT-capable Wi-Fi access points and peer Wi-Fi Aware devices. |\n| Networks: [**Wi-Fi local-only hotspot**](/develop/connectivity/localonlyhotspot) | Enable apps on devices connected to a Wi-Fi hotspot to communicate with each other. |\n| Bluetooth: [**Overview**](/develop/connectivity/bluetooth) | Overview of Android Bluetooth support, including basics and key classes and interfaces. |\n| Bluetooth: [**Bluetooth Classic**](/develop/connectivity/bluetooth/setup) | Set up baseline Bluetooth connectivity on your app. |\n| Bluetooth: [**Bluetooth Low Energy (BLE)**](/develop/connectivity/bluetooth/ble/ble-overview) | Transfer small amounts of data between nearby devices and interacting with proximity sensors. |\n| Bluetooth: [**BLE Audio**](/develop/connectivity/bluetooth/ble-audio/overview) | Receive high fidelity audio without sacrificing battery life, and let users seamlessly switch between different use cases. |\n| [**Near Field Communication (NFC)**](/develop/connectivity/nfc) | NFC is a set of short-range wireless technologies, typically requiring a distance of 4 cm or less to initiate a connection. |\n| [**Ranging**](/develop/connectivity/ranging) | Handle ranging sessions across multiple technologies. |\n| [**Telecom**](/develop/connectivity/telecom) | Manage audio and video calls, including eSIMs and SIM cards. |\n| [**Ultra Wideband (UWB) communication**](/develop/connectivity/uwb) | Measure precise ranging between devices. |\n| [**USB**](/develop/connectivity/usb) | Use USB accessory and USB host modes to support a variety of USB peripherals and Android USB accessories. |\n\nOptimizations\n-------------\n\nThe following guides can help you optimize your app for connectivity.\n\n| Guides ||\n|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| [Reduce network battery drainage](/develop/connectivity/preserving-battery) | Learn about strategies for preserving battery, user experience, and system health. |\n| [Reduce latency and increase network throughput](/develop/connectivity/cronet) | Learn how to use Cronet, a library derived from the Chromium network stack, to reduce latency and increase throughput of network requests. |"]]