On iPhone if I create custom service for example “_test._tcp.local.” in Bonjour I can seek/broadcast this service through WiFi or/and Bluetooth.
It is possible on Android ?
I know that there is jmDNS but from what I understand it works only through WiFi/Network,
EDIT by Seva Alekseyev, who offered the bounty: I’m not after workarounds (like Zeroconf sans Bluetooth or Bluetooth sans Zeroconf). I’m after the real thing.
Not on bluetooth, because Android currently doesn’t support TCP/IP over bluetooth, and Android’s native NSD support (network service discovery) works over IP.
It DOES, however, work over Wi-Fi. Also, Android supports service discovery over Wi-Fi Direct, which gives you greater range and battery efficiency than bluetooth. For a guide on how to integrate service discovery into a wi-fi direct enabled application, check out the Android Training lesson.
Portions of this answer are duplicated from our Dear Android video response to this question
Here is a sample of android dnssd :
You may need to modify the jmdns library such that it creates bluetooth sockets if bluetooth is ON, otherwise creates simple sockets. Encapsulate the socket communication in a different class that creates socket conditionally.
There’s a couple of reasons why this is not possible currently. The one most related to your question is that – as you probably experienced – jmDNS requires a TCP/IP link to publish or browse services (it requires an IP address to bind to). As the other answers & comments state, you’d need an established PANU link for that, which Android currently doesn’t provide.
The other reasons it will not work are:
- Apple uses a couple of mechanisms to assure iOS devices will only talk to other iOS devices. So even if you’d get Android into talking Bonjour-over-Bluetooth, it would only work Android-to-Android.
- Apple certified devices in the MFi program have a special crypto chip which is supplied by Apple. I’m not sure if this applies to Bonjour-over-Bluetooth connections as well, but I’d assume it does.
You could instead look into using Bluetooth 4 LE – at least there’s an Apple API for that starting in iOS 5 providing a Slave profile, and extended to support a Master profile in iOS 6.