Nearby Connections (as an API name) | 附近连接 (as a feature)
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
无论网络连接情况如何,Nearby Connections API 可让应用实时发现、连接附近的设备并与其交换数据。它使用蓝牙、Wi-Fi 和其他技术,旨在隐藏这些技术的复杂性,以便您的应用能够专注于发现附近的设备并与之互动。
在以下情况下,您应为您的应用选择 Nearby Connections API:
您希望发现附近的设备,而无需互联网连接,并且每次操作时都需要产生网络往返费用。
您想在附近的设备之间流式传输内容或者传输任意载荷或文件。
您想使用最新的点对点技术,例如 Wi-Fi 感知(如果可用)。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-13。
[null,null,["最后更新时间 (UTC):2025-08-13。"],[[["\u003cp\u003eThe Nearby Connections API enables real-time data exchange between devices, regardless of internet access, using Bluetooth, Wi-Fi, and other technologies.\u003c/p\u003e\n"],["\u003cp\u003eThis API simplifies device discovery and interaction by abstracting away underlying technology complexities.\u003c/p\u003e\n"],["\u003cp\u003eChoose this API for scenarios requiring offline device discovery, content streaming, or leveraging peer-to-peer technologies like Wi-Fi Aware.\u003c/p\u003e\n"]]],[],null,["# Nearby Connections\n\nThe [Nearby Connections API](/nearby/connections/overview) allows apps to\ndiscover, connect to, and exchange data with nearby devices in real-time,\nregardless of network connectivity. It uses Bluetooth, Wi-Fi, and other\ntechnologies, and is designed to hide the complexity of these technologies\nso your app can focus on discovering and interacting with nearby devices.\n\nYou should choose the Nearby Connections API for your app when:\n\n- You want to discover nearby devices without requiring Internet connectivity\n and incurring the cost of a network round-trip on each operation.\n\n- You want to stream content or transmit arbitrary payloads or files between\n nearby devices.\n\n- You want to use the latest peer-to-peer technologies such as\n [Wi-Fi Aware](//developer.android.com/guide/topics/connectivity/wifi-aware)\n when available."]]