Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Bluetooth in Android emulator?

Tags:

android

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.

like image 288
Rajapandian Avatar asked Feb 01 '10 06:02

Rajapandian


People also ask

How do I get Bluetooth on my Android emulator?

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.

How do I enable Bluetooth on my emulator?

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.

Is there an Android emulator that supports Bluetooth?

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.

Can Bluestack use Bluetooth?

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.


3 Answers

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"

like image 167
MrSnowflake Avatar answered Oct 24 '22 09:10

MrSnowflake


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.

like image 16
drott Avatar answered Oct 24 '22 11:10

drott


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.

like image 3
Martin Avatar answered Oct 24 '22 09:10

Martin