Bluetooth communication in Flash is not possible natively (yet), so using Java (with Bluecove library) you can achieve this by using Native Process in AIR.
It works like this: FlashApp < — > AIRApp< — > Java. Of course, the AIRApp needs to be working on the background, and the FlashApp will be you main application (or it can be another AIR application).
I created an API to let Flash send commands to bluetooth, by the way it uses AS3 Signals for events dispatching. This is a code sample for searching devices:
If the image looks a bit blurry, then you need glasses, nah just kidding, it actually looks like that
“Yeah that’s cool, but how do I set everything up to create my app?” ok here it goes:
The first thing you need to do is to install BluecoveAIR
That’s pretty everything you need to do in order to start using API. You can notice some options for Local Connection, these are default settings, if you wanna change them, type the new connection names in the input fields, but also remember to change them in the FlashBluetooth constructor in your Flash app.
This is a demo application to show how it works. You don’t have to worry much about the java output, it just displays what’s going on.
Note: First, place an mp3 file called “myFile” on drive C:\
When transfering the file, you’ll receive some permission notifications in your device, just accept them. Also will ask you to type PIN or code, it is 0000 (four zeros). The PIN code is hardcoded in the Java app, but yes, I will add the option to change that.
This was tested on Windows XP, Vista and 7, 32 bit. When I tried it on a Win7 x64 it didn’t work, so beware. (On that x64 machine, I later removed Win7 64 and then installed a 32 bit Win XP and it went ok)
It breaks my heart not being able to generate a .dmg since I don’t have a Mac =P but if someone creates it, let me know. Also if you wanna clean and/or optimize the Java source code.. please do.
Here’s a video showing it in action
(sorry for my bad english :X lol, not that “bad english”, I mean my pronunciation)