How to connect to Raspberry pi with an android app over bluetooth

后端 未结 4 1677
Happy的楠姐
Happy的楠姐 2021-01-31 06:31

I\'m having trouble connecting my smartphone to my raspberry pi over bluetooth using an app.

My situation:

I\'m developing a bluetooth controlla

4条回答
  •  无人及你
    2021-01-31 06:55

    I had faced a similar problem while connecting to a raspberrypi3 bluetooth via my android app. First execute the following commands one by one on your pi command prompt:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install bluetooth blueman bluez
    sudo reboot
    sudo apt-get install python-bluetooth
    

    After the execution of the above commands pair your app's bluetooth with pi's bluetooth. Now you need to add the SP profile to the Pi. Edit this file:

    Execute the following command on the pi command prompt:

    sudo nano /etc/systemd/system/dbus-org.bluez.service
    

    A file will open and add the compatibility flag, ' -C', at the end of the 'ExecStart=' line. Add a new line after that to add the SP profile. The two lines should look like this:

    ExecStart=/usr/lib/bluetooth/bluetoothd -C
    
    ExecStartPost=/usr/bin/sdptool add SP
    

    Save and reboot your pi and this should work.

提交回复
热议问题