views:

9934

answers:

4

I want to use iPhone SDK to implement a bluetooth connection between two iPhones, but I don't find any bluetooth API in iPhone SDK 3.0. Can anybody help me? Thanks.

BTW: Is it possible to connect more than two iPhones at the same time by using bluetooth?

+4  A: 

Check out the BeamIt open source project. It will connect via bluetooth and WIFI (although it claims it does not do WIFI) and I have verified that it works well in my projects. It will allow peer to peer contact easily.

As for multiple connections, it is possible, but you will have to edit the BeamIt source code to make it possible. I suggest reading the GameKit programming guide

coneybeare
A: 

If I remember correctly, Bluetooth defines certain roles that devices can take. Most cell phones only support a certain number of roles. For instance, I can have a Bluetooth stereo headset that connects to my phone to receive audio, but just because my cell phone has Bluetooth does mean that it supports BEING a speaker for a different device - it doesn't advertise its capabilities of having a speaker for use by other Bluetooth devices.

I assume you want to transfer files between two iPhones? Transferring files via Bluetooth does seem like functionality that I would put in the iPhone, but I'm not Apple so I don't know for sure. In fact, yes, it seems that file transfer is not supported except in jailbroken phones:

http://gizmodo.com/5138797/iphone-bluetooth-file-transfer-coming-soon-yes

You'll probably get similar answers for Bluetooth Dial-Up Networking. I'd imagine they kept the Bluetooth commands out of the SDK for various reasons and you'll have to jailbreak your phone to get the functionality back.

Stephen Friederichs
This answer is incorrect. GameKit allows data transfer between devices. I have working iPhone apps in production that do this.
coneybeare
Also, Bonjour now works seamlessly over Bluetooth as of iPhone OS 3.0.
Brad Larson
Apple iPhone has Bluetooth in it but they have locked down the interface to access Bluetooth to either the GameKit framework or Bonjour framework. Only devices that are in the 'made for iPhone' partner program can connect, not generic open standard Bluetooth stuff Headsets etc...There is a 'Made for iPhone' Bluetooth dev kit I think.
Pev
+9  A: 

You can connect two iPhones and transfer data via Bluetooth using either the high-level GameKit framework or the lower-level (but still easy to work with) Bonjour discovery mechanisms. Bonjour also works transparently between Bluetooth and WiFi on the iPhone under 3.0, so it's a good choice if you would like to support iPhone-to-iPhone data transfers on those two types of networks.

For more information, you can also look at the responses to these questions:

Brad Larson
I did try to use Bonjour over Bluetooth, it success on the service discovery but fails in resolving the ip address. How can I make use of the discovered service?
Ricky Lung
A: 

Hi, all, I'am Haitao and I have registered a new account here. thanks for your answer. and I have read some document about GameKit. But I still have a question: From the bluetooth spec, only up to 7 clients can connect to a bluetooth server and be kept in active state at the same time. But in the GameKit document, I don't find any client number limitation. If more than 7 clients can connect with a server through GameKit, some of them must be in sleep state, right? In such case, is it still Ok to send data to all connected clients, even if some ones are in sleep mode?

Thanks.

Soloman