Bluez implementation in android

2020-07-30 03:37发布

Can anyone please provide us any source code for bluez implementation in android. Actually we are trying to make an application with GATT profile. This android application should connect with other device by Bluetooth connection. Please suggest me what should be the best way to send data to a non android device.

1条回答
仙女界的扛把子
2楼-- · 2020-07-30 04:24

Look at Bluetooth chat example by Google, you also can use the same method to connect to a non android device. Specifically you will need this api

device.createRfcommSocketToServiceRecord(SerialPortServiceClass_UUID);

EDIT: You can also try using reflection to access another method like this

Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
mmSocket = (BluetoothSocket) m.invoke(mmDevice, Integer.valueOf(1));
查看更多
登录 后发表回答