/ google play services

Introduce Nearby Messages API

nearby_message_apiNearby exposes simple publish ans subscribe methods that rely on proximity. Your app publishes a payload that can be received by nearby subcribers. You can build a variety of user experiences to share messages and create real-time connections between bearby devices.

Today, in this article I will show you introduce Nearby Messages API. What is Nearby Messages API? The Nearby Messages API in a publish-subscribe API that lets you pass small binary payloads between internet-connected Android and iOS devices. The device don’t have to be on the same network, but they do have to be connected to the Internet.

Nearby user a combination of Bluetooth, Bluetooth Low Energy, Wi-Fi and an ultrasonic modem to communicate a unique-in-time pairing code between devices. The server facilitates message exchange between devices that detect the same pairing code.

Nearby Messages is unauthenticated and does not require a Google Account.

The exact mechanism for data exchange may vary form release to release. The following sequence show the events leading to message exchange.

  1. A publishing app makes a request to associate a binary payload (the message) with a unique-in-time pairing code (token). The server makes a teporary association between the message payload and the token.
  2. The publish device uses a combination of Bluetooth, Blutooth Low Energy, Wi-Fi and an ultrasonic modem to make the token detectable by nearby devices. The publishing device also uses these technologies to scan for tokens from other devices.
  3. A subscribing app associates its subscription with a token and uses a mix of the above technologies to send its token to the publisher, and to detect the publisher’s token.
  4. When either side detects the other’s token, it report it to server.
  5. The server facilitates message exchange between two devices when both are associated with a common token, and the API key used by the calling apps are associated with the same project in the Google Developers Console.

To use Nearby Messages API to your Android app, you can get more infomation in here: Getting started with Nearby Messages API on Android