简体   繁体   中英

Bluez implementation in android

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM