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.
Alternatively, Under settings of the virtual machine, Goto serialports -> Port 1 check Enable serial port select a port number then select port mode as disconnected click ok. now, start virtual machine. Under Devices -> USB Devices -> you can find your laptop bluetooth listed.
Once you have paired your devices, you can now start using Bluetooth on your Android Emulator. To do this, go to the “Settings” menu and select “Bluetooth”. You will then be able to see the list of paired devices. Select the device you want to use and you will be able to start using Bluetooth on your Android Emulator.
Android-x86 supports Bluetooth connections (if your PC has Bluetooth functionality), which means you can pretty much connect any Bluetooth device to your Android-x86 emulator and use it with it.
At the moment, support for Bluetooth connectivity, and Bluetooth sensors, is not available on BlueStacks 5. Hence, all apps which require control of Bluetooth or infrared sensors may not work on BlueStacks.
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"
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With