Can Android support Zeroconf/Bonjour over Bluetooth? How about TCP/IP?
Asked Answered
D

3

21

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, not Bluetooth.

Thanks

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.

Draughtsman answered 2/12, 2011 at 9:49 Comment(9)
I'm very curious to know the answer regarding bluetooth...is JmDNS alowed to detect bonjour services exposed by bluetooth ??Sagerman
Let start from the basics: is there a way to run TCP/IP over Bluetooth in Android? If so, one might be able to sic JmDNS on that particular interface. Maybe just the exposure, not the discovery, or vice versa.Bridging
Related: TCP/IP over Bluetooth in LinuxBridging
Related: same question on Android StackExchangeBridging
Related: #9367555Bridging
Yes, I think using the PAN profile should do it..Deontology
@userSeven7s: elaborate please. The bounty may be yet yours!Bridging
Take a look at this thread about bonjour over bluetooth in iphone..#3350594Deontology
PAN profile is not yet released for android. The code is present in the project but hidden. There are classes like BluetoothPan for PAN profile but but not to be used by developersDeontology
C
3

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

Corridor answered 25/10, 2012 at 17:48 Comment(0)
D
0

You can use BluetoothSocket and BluetoothServerSocket to create TCP like sockets over Bluetooth.

Here is a sample of android dnssd : https://github.com/twitwi/AndroidDnssdDemo

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.

Deontology answered 5/8, 2012 at 9:48 Comment(11)
Um, I'm ultimately after iOS-to-Android and vice versa service discovery. I don't think those would interoperate, as the iOS implementation is TCP/IP-based.Bridging
yes, Thats a high probability, but the documentation says its similar to TCP sockets.. So give it a try..Deontology
The sample doesn't claim Bluetooth compatibility and does not implement it. I had JmDNS integrated in my app for a while now; over TCP/IP on WiFi it talks to iOS fine. Now, just because the interface is similar, doesn't mean RFCOMM sockets can talk to TCP/IP ones. Those are different transports. I don't know enough about BT to know if it's possible to reimplement TCP/IP from scratch on top of Android's stack.Bridging
Sample rfcomm implementation... people.csail.mit.edu/albert/bluez-intro/x502.htmlDeontology
Thanks, that's not helping at all. Need I restate the original goal yet again? By the way - is there a native interface to Bluetooth that's on lower level than sockets?Bridging
You can talk directly to the Bluetooth microcontroller and speak HCI to it, which lets you do anything, but that's only possible if you're root. The kernel's public API to all this is firmly socket based. Unfortunately raw sockets in Bluetooth aren't very useful and in order to do anything interesting you also have to talk to the local SDP server, which speaks godsdamned dbus and not any sensible protocol.Clyde
You need to use an implementation of PAN profile.. not sure how.. Try bluezDeontology
@DavidGiven: can you elaborate? Sockets as in POSIX, with PF_BLUETOOTH? Where's the interface to SDP documented?Bridging
@userSeven7s: bluez requires root IIRC. I'm not going there.Bridging
@Seva Yes, Posix. The Bluez documentation is appalling, alas, and there's no man pages or anything useful like that; I mostly work off people.csail.mit.edu/albert/bluez-intro/x502.html and the headers. It's probably not what you're looking for, though. The low-level SDP interface isn't accessible from Android and while raw sockets work without being root they aren't much use unless you know the Bluetooth address and port you want to connect to, which you don't.Clyde
@SevaAlekseyev, have you found any solution to this?Surely
M
0

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.

Mulct answered 8/10, 2012 at 10:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.