How Google Nearby (really) works - and what else it does?

Franck Legendre By Franck Legendre on August 30th, 2015


First rumors of Google Nearby appeared early June 2014 and many expected an announcement at Google I/O a few weeks later. Two Google I/Os later, it is finally out! So how does Google Nearby (really) work? And what data you have to give away to Google to make it work?

Nearby has two main APIs: Nearby.Connections and Nearby.Messages. Nearby.Connections allows the discovery of devices connected to be on the same Wi-Fi network using multicast packets sent over the access point. Nearby.Messages doesn't require devices to be on the same Wi-Fi network. Instead, it uses various ad hoc radio technologies to broadcast a random token others can listen to. It does, however, require both devices to have their screen awake and to be online in order to work and we’ll see why next. In this post, we’ll only focus only on Nearby.Messages.

Google Nearby.Messages

How does Google Nearby.Messages work? - © FL/Uepaa, Aug. 2015.


We are going to illustrate how Nearby.Messages works through the example above of an iPhone (left) discovering an Android (right). Messages works in five steps: first, the iPhone registers online to the Google Cloud providing the token it will advertise, here “TA” (step 1). At the same time, it can publish tagged data, the other devices will get upon discovery, here, its name “iPhone6” with the tag “name”. In order to get this data, the Android phone has to subscribe to data tagged with “name” (step 2). Then, the iPhone beacons its unique token using various means: Bluetooth Low Energy and an ultrasonic sound while the Android listens to announced tokens (step 3). Upon discovery of the token (step 4), the Andoid will report and match it online against the Google cloud to find out the relevant data behind (hence the need to always be connected). The Google Cloud will message the Android with the Message “iPhone6” since it subscribed to the tag “name” (step 5).
Any subsequent data exchange will go through the cloud. No data is actually being sent peer-to-peer. A bit disappointed? We are too!

Nearby Discovery Technologies

Nearby.Messages uses more “discovery” technologies as illustrated above and here we provide more details based on our findings.

Audio - as shown in the illustration and the screen capture below, a random token is broadcasted using the phone’s speaker during 3 seconds interleaved by 1s of silence, and this repeatedly. Devices capture the ultrasonic sound through their microphone and process it to find out the sent token. This approach has, by the way, already been used in the PhotoCircle App for 3 years to enable the addition of a nearby user to a photo circle and it works between iOS and Android. Audio range is limited to a few meters and any wall would block sound (remember, walls have the annoying tendency to only let through low frequencies like your neighbor’s subwoofer ;-). )

Wi-Fi - according to the Google’s permission request to the user when first using Nearby, an iOS device sends the current WiFi AP (SSID) it is currently connected to (if connected of course) and an Android sends the list of WiFi AP around (as Google does already in the background to improve their location services). If there is a match when reporting to the Google cloud, that is both devices are connected to the same Wi-Fi access point or see the same set of Wi-Fi, the Google cloud considers both devices to be nearby.

Bluetooth Classic and Bluetooth Low Energy - this is where iOS and Android differ most. While an iOS device advertises its token using Bluetooth Low energy (BLE) using the Bluetooth LE peripheral name, Android temporarily changes your device Bluetooth name to the token. To discover devices around, an Android would scan for BLE peripherals to discover other Android devices and also scan for BLE peripherals to discover iOS devices. To discover devices around, an iOS device scans for BLE peripherals to discover other iOS devices. So if you are still following you might legitimately ask how an iOS device can discover an Android device when out of “sound” range. It scans for Bluetooth devices? Nope, scanning for Bluetooth devices is not permitted in iOS (unless using private APIs). So how does it work then? Well, that’s where the Google Cloud comes into play once again: the Android device will actually discover the iOS device, report to the Google Cloud who would in turn notify the iOS device that an Android is nearby. This is the missing arrow in the illustration above.

Google Nearby.Messages Audio

Nearby Audio capture using a microphone and iSpectrum - © FL/Uepaa, Aug. 2015.

On Privacy

So as you figured out, all data goes over the Google Cloud. This data includes discovered tokens but more might be sent such as Wi-Fi networks around (that is anyway done since long by Google and Apple to improve their location services), or other BLE or Bluetooth devices around (your fitbit, you bluetooth speakers). And remember that from discovery onwards, all data exchanes will flow through the Google cloud...

The Takeaway

To conclude, Nearby introduced a very fancy way – although not novel – to discover nearby devices using sound. Nearby however suffers from two main limitations, which seriously hampers what you can do with it: devices need to have their screens awake at the same time and always be online. This limits Nearby’s potential for intentional interactions where two parties implicitly or explicitly agreed to use Nearby, such as sharing a podcast with a friend.

Nearby has still a lot of catching up to do. p2pkit already offers what Nearby provides, plus more: it works in the background, works off-grid without network connectivity and all that without draining your battery and in a privacy-preserving way.

With p2pkit, we believe proximity is the next mobile revolution, facilitating nearby interactions through your phone. For this to happen, we wanted to provide you with the least limitations as possible so that only your imagination and the sky is the limit to your great ideas. Get inspired by our latest video here.

Carpe Diem et Technicam!
Follow @p2pkitio

Proximity through the eyes of Wi-Fi Aware and Google Nearby - An Industry Insight

Franck Legendre By Franck Legendre on July 20th, 2015


Last week was the forefront of two major tech announcements: Google's Nearby API and Wi-Fi Alliance's Wi-Fi Aware certification program.

Wi-Fi Aware, also called Wi-Fi NAN for Neighbor Awareness Networking, extends "Wi-Fi with real-time and energy efficient discovery" according to the Wi-Fi Alliance. The certification program is the last step before first chips being produced by chip makers are certified and can be commercialized to smartphone and access point manufacturers.

Google Nearby provides a proximity API, Nearby Messages, for iOS and Android devices to discover and communicate with each other. Nearby will be provided through a forthcoming update of the Google Play Services.

These are two great pieces of news. Why? First, proximity is gaining momentum and a key player – Google – is now entering the scene. Second, Wi-Fi Aware has the potential to become a key enabler technology for proximity and we can’t wait getting our hands on it.

That said, let's not get too excited too soon and go through a quick reality check.

Nather Carter

Nathan Carter - BRAVO LIMA UDON ELEPHANT, 2009 - © FL/MCA Chicago, Sep. 2010.

Wi-Fi Aware or Wi-Fi Direct v2.0?

As fancy as it sounds, Wi-Fi Aware is only a revamp of Wi-Fi Direct's neighbor detection with three major USPs and improvements: always on, battery efficient and scaling with crowd. Furthermore, not to dampen hopes but every new technology has its own lifecycle and maturity stages. Observing this for many years now, I expect first smartphones to embed Wi-Fi-Aware certified chips to be announced at the Mobile World Congress early March 2016. Besides, nothing ensures that iOS to Android cross-platform compatibility will prevail. It is very likely that iOS and Android will integrate Wi-Fi Aware in their respective existing frameworks: iOS for its "proprietary" AirDrop or Multipeer Connectivity Framework and Android for the p2p API. And Wi-Fi Direct will still be needed for p2p data exchange. Hence, I don't expect major changes compared to today's API and frameworks except that it will allow peer discovery to continuously run in the background . Last but not least, every technology – especially wireless ones – need time to reach maturity (i.e. bug fixing) and also to provide full compatibility between different "fragmented" devices’ hosting chips from different manufacturers (guess who I'm looking at? ;-) - this will be the topic of one of my next blog post with a retrospective on Wi-Fi, Wi-Fi Direct and BLE's early days.

Google Nearby or Sci-Fi?

Only little information was leaked on what Nearby's API provides and how it works. We'll have to wait a few more weeks until Nearby is unlocked for real. What is known for sure from Nearby's Product Manager and Lead Engineer is that Nearby "uses a combination of Bluetooth, Wi-Fi, and inaudible sound (using the device’s speaker and microphone) to establish proximity." A few (selected) Apps will provide a proximity feature within their app. But the main spoiler came from the Google Nearby Lead Software Engineer himself replying to a comment on an Android news page: "In order for the API to work, the users of both devices have to be in a special screen within the app. Because of this, Nearby doesn't use battery in the background, only when you're actively using it." This is like, "Hey bro, be ready at 5 with your screen on at the crossing of G and L street, I'll post you a message (and I'll be behind you). Well, Nearby will be in Beta so I don't expect too much at start... and as this is Google this will progress fast. Most appealing is the use of sound to detect proximity. It really sounds like sci-fi, uh? Well, not so sure. My former research colleagues have shown that localisation could be achieved with smartphones using sound. The problem with that is that either (i) it uses ultrasound and you'll notice every time you open the "Discover Nearby" feature in your app that your dog starts getting crazy or (ii) more realistically, as Emanuel one of our new engineers speculated, it will rely on a proximity detector à la Shazam: sample the ambient noise from both phones and if there is a match, bingo, we're nearby!

The Takeaway

I'm thrilled by these latest developments and a world where proximity interactions will be facilitated by technology. By the way, we forgot LTE-Direct, not yet under the spotlight but certainly a direct competitor to Wi-Fi Aware. LTE-Direct will be featured in one of my forthcoming blog posts and is a pretty long story as it involves one additional character, Telcos, who also want their share of the proximity pie. The good news is that, we, at Uepaa will leverage all these upcoming technologies for p2pkit.

However we decided a while ago not to wait another year and so made it happen now. p2pkit is about to leave beta stage with first clients, and we've optimized it to run continuously in the background and unnoticed. I truly believe proximity features will be the next big thing and this is why we’re investing to make it happen asap. Oliver, one of my Master students from ETH Zürich, is already working on scaling p2pkit to large crowds and first results are promising (more news soon).

Carpe Diem et Technicam!

PS: This is the first of a series of blog posts. If you liked it, please don't forget to subscribe to our mailing-list or follow us on Twitter (@p2pkitio) and please share this post! For feedback and comments, email me.

Follow @p2pkitio