• Home
  • Q&A
  • How to use Bluetooth in Android emulator?

How to use Bluetooth in Android emulator?

February 01, 2010
11 score
6 answers

I want to create an application based on bluetooth operation in android.I am using the following code

 BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();

the adapter is returning null value, which means the android emulator is not having bluetooth capability. i am using android 2.1 the latest version of android.Anybody knows how to use the bluetooth from android emulator, please help me.


12 score

You can't. The emulator does not support Bluetooth, as mentioned in the SDK's docs and on several other places.

And you already discovered this yourself: "the adapter is returning null value, which means the android emulator is not having bluetooth capability"

answered February 01, 2010
5 score

Q. Bluetooth doesn't work on my device. How should I debug?

A. First step - read the logs (adb logcat)! In particular look for ERROR or WARNING level messages regarding Bluetooth.

Andoird uses Bluez, which comes with some very useful debugging tools. Here are some examples, in the rough order I use to debug BT.

hciconfig -a  # print BT chipset address and features. Useful to
# check if you can communicate with your BT chipset.

hcidump -XVt  # print live HCI UART traffic.
hcitool scan  # scan for local devices. Useful to check if RX/TX works.
l2ping ADDRESS  # ping another BT device. Useful to check if RX/TX works.
sdptool records ADDRESS # request the SDP records of another BT device.

You can install the bluetooth plugin from http://www.android-videos.blogspot.com/ Once the installation is done you can use bluetooth with the Emulator.

answered March 10, 2011
3 score

You can install the image from http://www.android-x86.org/ into a virtual machine (e.g. VMWare), find out it's IP address, connect manually using

adb connect <IP of VM>

And then launch your project from Eclipse by setting a "Manual" deployment target in your Debug/Run configuration. Bluetooth works in this Virtual Machine at least on my Macbook and it's reported to work with a couple of other bluetooth chipsets.

answered February 13, 2011
1 score

It's not possible to run bluetooth aap on emulator.as there is no support for bluetooth on emulator. look at this http://developer.android.com/guide/developing/devices/emulator.html Emulator Limitations

In this release, the limitations of the emulator include: No support for placing or receiving actual phone calls. You can simulate phone calls (placed and received) through the emulator console, however. No support for USB connections No support for camera/video capture (input). No support for device-attached headphones No support for determining connected state No support for determining battery charge level and AC charging state No support for determining SD card insert/eject No support for Bluetooth

answered November 14, 2011
1 score

I'm currently planning a tool that is capable of emulating Bluetooth over TCP/IP under Linux (will be released freely under GPL).

This should be the solution when not having a real Bluetooth device (e.g. you want to simulate a connection between two emulated Android-x86 or Linux machines).

Maybe when compiling for Linux-ARM instead of Linux-x86 it will run in the Emulator, too.

answered March 10, 2012
0 score

Yes, I agree, right now the emulator does not support Bluetooth.

To compile Android with Bluetooth support enabled, add the following line to BoardConfig.mk.

answered April 10, 2010