On Android, everything went smooth. Except, you can't set a device to be discoverable for an unlimited timespan.
Then came the iPhone: In brief, it doesn't work. In detail, this is what I tried:
- Looked for a Bluetooth API. There is none except iOS 5's Bluetooth 4 Low Energy (LE) one, which requires a BT 4 capable hardware - which is only the iPhone 4S currently. On my iPad 2 it doesn't discover anything. Same on my neighbor's iPhone 4S: Obviously, this API can only detect low range BT 4 LE devices. The "dual-mode" (enabling the chipset to run in the otherwise incompatible 2/3 and 4 versions, according to Wikipedia) seems unsupported.
- Looked for 3rd party frameworks. There are some, but they require a rooted iPhone and/or take any chance of getting the App into the App store.
- The high-level API called GameKit is only able to connect to other iOS-devices, and there are quite some people who tried to connect somehow - without success.
- Tried to use the Bonjour low-level API (dns_sd.h) and found two problems with that:
- Discovering services via Bluetooth unsurprisingly only seems to work on active Bluetooth connections: I paired and connected my iPad to my Mac (had to initiate the connection from the iPad to the Mac, the other way does not seem to find a usable combination of profiles). After disabling WiFi on the iPad, I ran the BonjourWeb sample on it and
dns-sd -A
on the Mac to get provide a Bonjour service to be discovered. Success! The iPad discovered the sample service (Proof: disappeared when stopping the service on the Mac). The bad news: The iPad didn't discover anything as soon as the Bluetooth connection was dropped (without even touching the pairing). Side note: Without an active connection, the Mac doesn't provide a Bluetooth interface that Bonjour can bind to, so even if iOS didn't require an active connection, the other side probably would anyway. Learned assumption: iOS probably accepts Bluetooth GameKit connections (i.e. Bluetooth PAN(U) connections) temporarily without asking the user to provide a link-layer to Bonjour... - I tried to setup Bonjour (zeroconf) via Bluetooth on Android. I used the existing JmDNS for that, which is capable of binding to any device that has an IP. I quickly found that the Android Bluetooth API doesn't support the PAN(U) profile (starting with Android 3.0, the API seems extended though), and even on my rooted Android phone I would have needed to add some kernel modules... Plus, JmDNS also requires an IP address that is only assigned after a connection has been established (that's the behavior on my Linux box at least).
- Discovering services via Bluetooth unsurprisingly only seems to work on active Bluetooth connections: I paired and connected my iPad to my Mac (had to initiate the connection from the iPad to the Mac, the other way does not seem to find a usable combination of profiles). After disabling WiFi on the iPad, I ran the BonjourWeb sample on it and
(post has been updated on Feb 8)
8 comments:
Tx for this very interesting study. I'm trying to do the same and I have the same conclusion...It seems not possible to detect an iOS bluetooth bonjour service from an Android phone :(
Did you have any update ?
No, no progress on this. If you (or someone else) gets further, I'd love to know!
iOS 6 has some new CoreBluetooth features that appear to allow iPhone to iPhone bluetooth discovery. I think it still requires iPhone 4S, iPhone 5 or iPad 3 (BLE). Have you explored this?
RovingShoe: I haven't actually tested it, but iOS6 apparently comes with a BT4 LE "server" profile (aka "peripheral mode"). Apple announced in the Release Notes that his allows iOS-to-iOS communication.
You're right anyway that this will only work with BT4 capable devices (iPhone4S+ and iPad3+). Whether the CoreBluetooth API supports Non-iOS/Non-MFI BT4 devices - I don't know. If anyone tried, please leave a comment!
Thanks for the article. I just read that all iPhone models support the PAN profile via the GameKit, but from your post it wont work. Hopefully I'll get some time to investigate the CoreBluetooth API.
Brenty: CoreBluetooth is iOS's Bluetooth 4 Low Energy API. Except for the name does that technology not share much with the "original" Bluetooth - for the least, it's not compatible at all with other Bluetooth versions.
That said, Android only recently delivered a unified BT4 API with KitKat (4.4). iOS 7 included support for server and client profiles, so indeed might there be a way to finally connect both worlds - I haven't tried it though.
Post a Comment