Bluez implementation in android

六月ゝ 毕业季﹏ 提交于 2019-12-06 14:41:20

问题


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:


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));


来源:https://stackoverflow.com/questions/12245242/bluez-implementation-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!