I created a custom app to connect via bluetooth to my Raspberry Pi. All it does is it scans for bluetooth devices and connects to them through an RFCOMM socket.
As per this Android documentation I have the following code when creating the socket on my app, by using the well-known SPP UUID.
val uuid: UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb")
device.createRfcommSocketToServiceRecord(uuid)
Everything works great!
The thing is, I would like it if only those using my app (i.e. those who have been authenticated by me) could connect to my Raspberry Pi.
Is it possible to set a custom UUID for the Raspberry's RFCOMM server?
EDIT:
I've made some progress by using this example code from the pybluez module. However, what happens now is that I can establish a connection by using two different UUIDs, the one I set on the python script and the default well-known SPP UUID.
How could I make it so that it works exclusively with the one I set?