As far as I know it's impossible to send or receive data over RFCOMM sockets without pairing. I've tried this extensively with an application that I'm developing. My results are:
- If the two devices are paired and discoverable, bi-directional communication is possible
- If the two devices are paired, but the "server" device (the one the android device is trying to connect to) is set to be not discoverable, then bi-directional communication is still possible
- If the two devices are not paired, but the "server" device is discoverable, then a pairing request is still required before bi-directional communication is possible. This means that RFCOMM client sockets (i.e., those from Android) require the devices to be paired. This was tested on a Samsung Captivate running Android 2.2. I find this very strange, as I can understand requiring pairing before allowing RFCOMM server sockets, but requiring pairing for client sockets is a bit stringent.
As @ethrbunny mentioned you can also just use WiFi, setup parallel server/client threads on each device, and send whatever you want. To discover services on a local network you can optionally use zeroconf.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…