A module for appcelerator that allows two iOS devices to communicate bidirectionally over bluetooth.
Objective-C Python C JavaScript
Latest commit e74e3a8 Jan 14, 2011 @smontgomerie No commit message
Failed to load latest commit information.
Classes Documentation Jan 11, 2011
bluetoothmodule.xcodeproj Documentation Jan 11, 2011
documentation Initial commit Oct 31, 2010
example Initial commit Oct 31, 2010
hooks Initial commit Oct 31, 2010
ComSmontgomerieBluetooth_Prefix.pch Added files Jan 11, 2011
LICENSE Added license Jan 11, 2011
README Added files Jan 11, 2011
README.rdoc No commit message Jan 14, 2011
build.py Initial commit Oct 31, 2010
manifest Initial commit Oct 31, 2010
module.xcconfig Initial commit Oct 31, 2010
titanium.xcconfig Documentation Jan 11, 2011


Appcelerator Bluetooth Module

A module for appcelerator that allows two iOS devices to communicate bidirectionally over bluetooth.


First download the code: git clone git@github.com:smontgomerie/Appcelerator-iPhone-Bluetooth-Module.git cd Appcelerator-iPhone-Bluetooth-Module

Then build the code. ./build.py

If you get an error, it's likely that the Titanium SDK is wrong. Modify the “titanium.xconfig” file:

TITANIUM_SDK_VERSION = 1.4.0 (or whatever version of the mobile SDK you're using).

This directory should be present: TITANIUM_SDK = ${HOME}/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)

If not, modify it to the installation of your Titanium Mobile SDK.

Next, install the calendar into your app. cp com.smontgomerie.bluetooth-iphone-xxx.zip ~/Library/Application\ Support/Titanium/

Finally, in your app's tiapp.xml file: <modules>

	  <module version="xxx">com.smontgomerie.bluetooth</module>

Make sure to change the “xxx” to the version of the module that's been compiled.

You'll need to at least touch your iPhone app before including it (assuming you're building with Xcode, not Titanium).

Basic Usage

First, we'll need to add the Framework in Xcode. Select Frame-works in your project folder, right click “Add -> Existing Frameworks” and select the menu item. *Add GameKit.framework*

Next, we'll want to require this module in our Appcelerator Javascript code:

var bluetooth = require(“com.smontgomerie.bluetooth”); Ti.API.info(“module is => ” + bluetooth);

Next, some example code to start connecting:

// Create a button called connectBtn

connectBtn.addEventListener(“click”, function() { bluetooth.startPicker(); });

Do something useful when another user connects:

bluetooth.addEventListener(“didConnect”, function(e) { var peerID = e.peerID; });

Now, send some data to our peer: // Create a button called “sendBtn” sendBtn.addEventListener(“click”, function() { bluetooth.send({ data: “Hi” }); });

And do something when we receive data:

bluetooth.addEventListener(“receive”, function(e) { Ti.API.info(e); Ti.API.info(e.data); });

That's pretty much it! Any edits/improvements are appreciated.


  • Support multiplayer

  • Support voice chat

  • Support more events, such as the client will disconnect

  • Right now the module connects where both clients can be servers. Allow the user to choose a server or client mode.

  • Allow a custom peer picker UI. Apple's Gamekit PeerPicker UI sucks.