how to test bluetooth application on emulators in android
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 th开发者_Python百科ere 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?
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.
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
- 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.
You can simply check the option and start testing the android bluetooth application .
this worked for me . Hope you find the solution.
精彩评论