how to test bluetooth application on emulators in android
Asked Answered
M

2

13

I've made a Bluetooth chat application on Android and I need to test it, but I do not own an Android phone so I am dependent on an emulator for all my testing purposes. Is there a way for me to test Bluetooth-based applications on an Android emulator? I am using Eclipse for development. I'd like to run 2 emulators simultaneously and see if my chat application is working properly or not.

Also, how can I integrate the new emulator with Eclipse?

Madalinemadalyn answered 18/8, 2011 at 6:20 Comment(1)
#2384961Gatehouse
A
18

Fortunately, there is a way out - Install the Android image on a VM and use your own Bluetooth device. Follow these Steps:

  • Download Androidx86 from http://www.android-x86.org/. This is an .iso file, so you'd need something like VMWare or VirtualBox to run it. Me, I use VirtualBox.

  • When creating the virtual machine, you need to set the type of guest OS as Linux instead of Other.

  • After creating the virtual machine, set the network adapter to 'Bridged'.

  • Start the VM and select 'Live CD VESA' at boot.

  • Now you need to find out the ip of this VM. Go to terminal in VM (use Alt+F1 & Alt+F7 to toggle) and use the netcfg command to find this.

  • Now you need open a command prompt and go to your android install folder (on host). This is usually C:\Program Files\Android\android-sdk\platform-tools>.

  • Type adb connect IP_ADDRESS

  • There done! Now you need to add Bluetooth. Plug in your USB Bluetooth dongle.

  • In VirtualBox screen, go to Devices>USB devices. Select your dongle.

  • Done! now your Android VM has Bluetooth. Try powering on Bluetooth and discovering/paring with other devices.

  • Now all that remains is to go to Eclipse, and run your program. The Android AVD manager should show the VM as a device on the list.

Aeonian answered 4/11, 2011 at 2:47 Comment(0)
B
5

i am tired if searching the answer for this question and finally i got the solution out of my personal experience.

Under settings of the virtual machine,goto serialports -> Port 1

  1. check Enable serial port
  2. select a port number
  3. then select port mode as disconnected
  4. click ok.

now,start virtual machine.

Under Devices -> USB Devices -> you can find your laptop bluetooth listed.

You can simply check the option and start testing the android bluetooth application .

this worked for me . Hope you find the solution.

Burletta answered 19/2, 2013 at 0:45 Comment(2)
All forum posts saying not possible. After trying it in vmware for hours, I was able to do it with your method in Virtualbox. Thank you so much. Please add Virtualbox to the description.Nudibranch
Additionaly commands for enable bluetooth device in Android Emulator. If you get a crash error over an over again, you can use down command at last line. And than check your bluetooth discovery page: ``` pm enable com.android.bluetooth service call bluetooth_manager 6 hciconfig hci0 up #hciconfig hci0 down ```Nudibranch

© 2022 - 2024 — McMap. All rights reserved.