Android Components > Libraries > Nearby
A component simplifying use of Google's Nearby Connections API, which provides "peer-to-peer networking API that allows apps to easily discover, connect to, and exchange data with nearby devices in real-time, regardless of network connectivity. "
Main features:
- Support for communication via wifi or Bluetooth directly between two Android devices.
- Messages are securely encrypted (unless the client disables authentication, which is not recommended).
Use Gradle to download the library from maven.mozilla.org (Setup repository):
implementation "org.mozilla.components:lib-nearby:{latest-version}"
- Communication is limited to a pair of devices.
- Currently, messages are limited to 32 KB.
- To make a connection, one device must call
startAdvertising()
and another must callstartDiscovering()
. - This depends on Google Play services 11.0 or higher.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/