Discussion Forums For iPhone Developers – Android Developers – BlackBerry Developers

You must be logged in to post Login Register

Search Forums:


 




Is there a way to ignore bluetooth connections and only use wifi?

UserPost

9:29 am
September 13, 2009


coneybeare

Member

posts 11

1

I am interested in completely avoiding the bluetooth connectivity until Apple resolves most of the GameKit bugs.  I still want to use the wifi bonjour service though, and only want to ignore the bluetooth devices.

In the GKTank sample, this can be done by setting a connectionTypeMask to online instead of wifi, but I have found no equivalent in the BeamIt code.  Can you recommend a way to prevent the app from using the bluetooth connection?

12:10 pm
September 13, 2009


gchaurais

Member

posts 9

2

In the GKTank example, they use the PeerPicker to discover other devices. In the Beam It! project, we do not use the peer picker, since we're writting our own way of finding devices.


In order to make Beam It! use WiFi, you'd need to re-write the SessionManager class, because this is the class responsible for maintaining the GKSession instance. You'd need to provide your own way to find devices through bonjour there, the same way you'd make it using the PeerPicker. The GKSession class we used works only with Bluetooth. So, whenever we use the GKSession class, you'd need to provide your own way to make the same thing, since Apple doesn't provide a way to use WiFi this way.


- Gustavo Chaurais

12:37 pm
September 13, 2009


coneybeare

Member

posts 11

3

Actually, this is not true.  The GK Session also transparently works over wifi due to Apple's behind the scene bonjour work.  To test this, turn off the bluetooth on your device and run the app.


What I can't find, however, is a way to distinguish the type of connection established by GKSession so that I can block the Bluetooth ones.


The peer picker is only for the GUI portion of the GKTank, not the underlying GameKit

3:35 pm
September 13, 2009


coneybeare

Member

posts 11

4

Ok, there is tons of contradictory statements about this in the docs and in the devforums.  But the evidence I present is that on my two devices, with the bluetooth turned off in the settings app, the two devices still see each other and still transfer.  Digging through the api, I cannot figure out how to get the connection type from a peer or session.


The only thing I can think of now is to give instructions that suggest that both users need to be connected to the same wifi to work.  It is curious, however, that if I turn wifi off on both devices, and bluetooth on, that i can never establish a connection through GKSession.  

4:55 pm
September 13, 2009


coneybeare

Member

posts 11

5

I can also confirm that I send files between 1st gen iPods and 1st gen phones (no GameKit support over BlueTooth) as well.

9:02 pm
September 14, 2009


coneybeare

Member

posts 11

6

Post edited 12:27 pm – September 15, 2009 by Adam


I ended up abandoning Bluetooth in the BeamIt framework for my app.  File transfers work fine with the BeamIt implementation of the GameKit API over WIFI and I am only allowing my users to transfer using the wifi connection.  I do this by not allowing access to the file transfer page in my app unless they have an active wifi connection.


To anybody new reading this post, I have working code for large file transfers over WIFI using BeamIt as a starting point. I have implemented packet transfers, packet acknowledgements and custom UI around this.  While I won't share all my code, I will help you where I can if you contact me.

@coneybeare on twitter



  • Share/Bookmark