I have an Android application which connects serially to my Raspberry Pi 3 over Bluetooth. Before development of my app, I tested the bluetooth on the pi with an application called Bluetooth Terminal. It worked perfectly. In order to "see" the data being sent over the serial channel, I would have to run:
$sudo rfcomm release 0
$sudo rfcomm bind hcio XX:XX:XX:XX:XX:XX 1
$sudo rfcomm listen XX:XX:XX:XX:XX:XX 0
Waiting for connection on channel 1
CTL^C to hang-up
Every time I disconnected the app, I would have to release the channel and then re-connect before I re-ran the Bluetooth Terminal app, and it work perfectly every time.
However, with my app that I have created, it says:
$sudo rfcomm release 0
$sudo rfcomm bind hcio XX:XX:XX:XX:XX:XX 1
$sudo rfcomm listen XX:XX:XX:XX:XX:XX 0
Waiting for connection on channel 1
Can't create RFCOMM TTY: Address already in use
I receive this error even after the release of the channel. I've tried:
$sudo rfcomm watch 0
Even that throws the same error.