Reputation: 64844
What is the required to allow android application to communicate with Bluetooth-enabled devices (that uses the easy Bluetooth module
)?
Do I need to use the normal BluetoothAdapter
class . I have tried the chat example attached with android samples. But the android application can't discover the Bluetooth device ?
What is the problem , do I need to use Bluetooth profiles ?
Upvotes: 0
Views: 1781
Reputation: 18440
Typically these modules using Serial profile, so you can use BluetoothAdapter normally. I've a similar module that is attached to a micro-controller and it is working fine with Android app.
Here is a quick code snippet to connect to a known device over Serial profile
String BTAddress = "ADD YOUR REMOTE DEVICE BLUETOOTH ADDRESS HERE"; // has the format 00:00:00:00:00:00
UUID SERIAL_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
BluetoothDevice btDevice = btAdapter.getRemoteDevice(BTAddress);
btSocket = btDevice.createRfcommSocketToServiceRecord(SERIAL_UUID);
btSocket.connect();
Upvotes: 2