Multi-platform API for Google Nearby Messages
I happened upon a video presentation from Google I/O 2016 that I felt was interesting. It was called “Introducing Nearby: Physical proximity within and without apps – Google I/O 2016”. I present it here for your viewing convenience.
At the 9:27 mark a feature is described as “Earshot”. This means that for devices to discover one another, they need to be within 3-5 feet of one another. Obviously this uses an ultrasonic modem. I was quite interested in this feature. BLE and BT can bleed through walls, and I wanted discovery to be limited to a room and by near field.
So I started developing for iOS using cocoapods. It’s fairly straight forwards as I went through some tutorial code supplied by Google at their Messages API center. Nearby Connections and Nearby Notifications are Android-only silos.
I began to see differences in the APIs for Android and for iOS in regards to the Messages API. What is seen in the recent I/O video above, a setDistanceType(DISTANCE_TYPE_EARSHOT) does not exist for iOS. There is a lack of parity there. For iOS, one needs to create a GNSStrategy object with GNSStrategyParams with a discoveryMediums of Audio. These equate to the same thing. But you might not know that and beat the trees for parity you won’t find.
Okay, so the APIs and documentation for iOS needs updating since Earshot was mentioned explicitly for Android in the presentation.
The iOS APIs have many deprecations – which is fine. But the documentation supplied doesn’t offer snippets or method signatures for what new methods replace them. Really? I have to StackOverflow questions for answers? Thankfully those in the know watch the Nearby tagged questions religiously – for I got answers within hours.
Please assign some people to update the documentation and perhaps rail out a Swift version. I don’t mind bridging headers, but those are probably going away in the near future.