Send / receive data via Bluetooth

I am trying to send / receive a string from an Android device. I’ve been searching for the past 3 hours, and I can’t find anything that just works. nearest i got this: fella

and I get the following errors:

02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.errat com.example.jelle.bluetoothconnector.BluetoothConnection.init(BluetoothConnection.java:38) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.errat com.example.jelle.bluetoothconnector.BluetoothConnection.<init>(BluetoothConnection.java:25) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.errat com.example.jelle.bluetoothconnector.ConnectorActivity.btnBluetooth_onCLick(ConnectorActivity.java:92) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.errat java.lang.reflect.Method.invoke(Native Method) 02-19 15:44:17.680 4680-4680/com.example.jelle.bluetoothconnector W/System.errat java.lang.reflect.Method.invoke(Method.java:372) 

Can anybody help me? I just need a code that can send / receive a string via bluetooth to run me.

Thanks!

+6
source share
1 answer

The best and most complete example is the official Android Bluetooth chat example. You probably don't need to change most of the material. See this: http://developer.android.com/samples/BluetoothChat/index.html

+4
source

Source: https://habr.com/ru/post/982747/


All Articles