In Google Play services version 11.0, the Nearby Connections API was updated with a number of significant changes, including the following new features:
- Offline support. Nearby Connections now works fully offline, no network connectivity required. Devices no longer need to be connected to the same multicast-enabled wifi network to discover or connect to each other.
- Encrypted connections. Connections established between devices are now fully encrypted, ensuring that only the intended partipicants can read exchanged data.
- Large payload support. Nearby Connections now supports large Payload objects, which may be messages (up to 32kb), files, and even streaming data. The API also provides realtime progress updates about in-flight payloads.
- Simplified, symmetric API. The API has been simplified to be easy to use and more symmetric between advertiser and discoverer devices.
Learn more about the new functionality in the updated documentation.
This section highlights some key differences between version 11.0 and previous versions of Nearby Connections.
- It is now possible to advertise and discover at the same time.
- You no longer need to check network connectivity or prompt users to connect to a multicast-enabled wifi network.
- It is no longer required to declare your
SERVICE_IDin AndroidManifest.xml. Instead, pass it as a parameter to both
- There is now no distinction between "reliable" and "unreliable" send methods,
sendUnreliableMessage()are now deprecated. All payloads are sent via
sendPayload()and are guaranteed to be delivered in order.
- The device ID of discovered endpoints is no longer exposed.