How to use Bluetooth in Android emulator?
I want to create an application based on bluetooth operation in android.I am using the following code
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.
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"
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.
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.
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
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.
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.
BOARD_HAVE_BLUETOOTH := true