How to use Bluetooth in Android emulator?

前端 未结 8 1927
醉梦人生
醉梦人生 2020-11-29 03:14

I want to create an application based on bluetooth operation in android.I am using the following code

 BluetoothAdapter adapter=BluetoothAdapter.getDefaultAd         


        
相关标签:
8条回答
  • 2020-11-29 04:11

    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.

    0 讨论(0)
  • 2020-11-29 04:11

    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.

    0 讨论(0)
提交回复
热议问题