E.S.
E.S.

Reputation: 2841

How do you develop Android apps with Bluetooth?

How do you effectively develop, debug, and test an android app that is based on Bluetooth.

I have been googling and searing stack overflow for the answer to this question and I am not getting a clear answer.

I understand that the emulators do not support Bluetooth. I also know of various guides explaining the functions, classes, and such, and I know people have mentioned that setting up a Bluetooth emulator is possible with Virtualbox. I even came across some old projects like BT-Sim that seemed like a way to create fake BT signals (though if my android emulator doesn't support BT, it doesn't help too much)

But no solid guide on how to get this going. It just likes a few scattered puzzle peaces that need to be stitched together. It makes me wonder how app developers reliably make BT enabled apps?

Are there any guides that dissect how to do this process? I imagine the steps to accomplish are:

  1. Create a custom emulator on Virtualbox that can simulate Bluetooth?
  2. Get the AVD Manager to talk to this emulator so my compiled Android code will work with it
  3. Run a Bluetooth simulator to send BT signals over a port in your computer

(I don't really know how to do either of those 3 though!)

My overall goal is as follows:

I'll be honest, I do find it odd that the Google folks don't allow Bluetooth emulation on their AVD. I understand not allowing real telephone calls, but I don't see how Bluetooth can be abused like that.

Anyway, any help in setting up Bluetooth would be greatly appreciated and hopefully help many others out there!

NOTE: I am using the standard Eclipse + Android SDK setup with AVD to do my Android development. Planning to use API 10. However, if I need to use a different set up, I am fine. As long as it comes with a step by step guide! That would be very nice.

Upvotes: 3

Views: 4005

Answers (1)

aland
aland

Reputation: 2004

Old question, but it's still unanswered. If you have a physical device, that seems easiest way to go. If, like me, you don't have a device it's still possible to develop with bluetooth and android. Download an android x86 iso, load it into virtualbox with bridged network setting and install it. Plug in your bluetooth dongle and select the device from the 'usb' menu, alternatively you can set a device filter in the vm's settings page. Now just use adb and connect to it, you can find the ip by going to console (alt+f1) and typing netcfg or ifconfig eth0. You may also need to type adbd on the android console - I do, but I don't see many people mention it so seems it's not always needed.

It still works with eclipse, and is much faster than the emulator. Even when I'm not doing bluetooth dev I use the vm rather than the emulator.

Upvotes: 2

Related Questions