Communication between Mac and android app over different network

Hi, I'm working on a sample app to enable two-way data transfer between Mac, iOS, and Android devices.

The devices will be in close proximity to each other. To implement this, I used Google's Nearby API, which supports cross-platform communication.

The approach has worked well for Mac and iOS devices, even across different networks. However, while Mac and Android devices communicate successfully when on the same network, they fail to discover each other when on different networks.

Mac ↔️ iOS-----Works fine in all scenarios.

Mac ↔️ Android-------Works only when both devices are on the same network, but fails to discover each other on different networks.

Is there any alternative approach to achieve reliable cross-platform communication, or any technical documentation that could help with this? Thanks in advance!

Answered by DTS Engineer in 804349022

I can’t really speak to the behaviour of non-Apple platforms and libraries. I suspect that the library you’re using is based on Bonjour, that is, Apple speak for these three industry-standard protocols:

By default, Bonjour requires that all devices be on the same network. Apple’s platforms extend that support to support peer-to-peer Wi-Fi. So, if you configure our Bonjour APIs correctly, you can discover Apple devices that aren’t on the same Wi-Fi network. You can learn more about this in the Peer-to-peer networking section of TN3151 Choosing the right networking API. And, as noted in that section:

The on-the-wire protocol used by peer-to-peer Wi-Fi is not documented for third-party use, so this technique only works between Apple devices.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

I can’t really speak to the behaviour of non-Apple platforms and libraries. I suspect that the library you’re using is based on Bonjour, that is, Apple speak for these three industry-standard protocols:

By default, Bonjour requires that all devices be on the same network. Apple’s platforms extend that support to support peer-to-peer Wi-Fi. So, if you configure our Bonjour APIs correctly, you can discover Apple devices that aren’t on the same Wi-Fi network. You can learn more about this in the Peer-to-peer networking section of TN3151 Choosing the right networking API. And, as noted in that section:

The on-the-wire protocol used by peer-to-peer Wi-Fi is not documented for third-party use, so this technique only works between Apple devices.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Communication between Mac and android app over different network
 
 
Q