androidgoogle-nearby

How does Google's nearby share discover devices that do not advertise themself?


Recently I was interested by the Nearby Share functionality and i started looking into the Google's Nearby Connections API.

The API uses a "advertise" and "discover" setup, where one of the devices advertises itself using the API and the other tries to discover all the devices nearby.

But, on the other hand, the Nearby Share functionality does not require a explicit "advertise" step.

My questions are the following:


Solution

  • Nearby Share has a service that calls #startAdvertising (and rotates it every 10~15min).

    We have looked at ways to bootstrap NC. eg. Passing an IP:port or MAC address out of band (like through a QR code). But such an API hasn't been written yet. It can get complicated, since NC doesn't want to expose this raw information to clients, so how does the client know what to put in the QR code?