通过蓝牙发送/接收数据

Sne*_*lle 7 sockets android bluetooth android-bluetooth bluetooth-socket

我正在尝试从Android设备发送/接收字符串.我一直在谷歌搜索过去3个小时,我找不到任何有效的东西.我得到的最接近的是:家伙

我收到这些错误:

02-19 15:44:17.680    4680-4680/com.example.jelle.bluetoothconnector W/System.err? at com.example.jelle.bluetoothconnector.BluetoothConnection.init(BluetoothConnection.java:38)
02-19 15:44:17.680    4680-4680/com.example.jelle.bluetoothconnector W/System.err? at com.example.jelle.bluetoothconnector.BluetoothConnection.<init>(BluetoothConnection.java:25)
02-19 15:44:17.680    4680-4680/com.example.jelle.bluetoothconnector W/System.err? at com.example.jelle.bluetoothconnector.ConnectorActivity.btnBluetooth_onCLick(ConnectorActivity.java:92)
02-19 15:44:17.680    4680-4680/com.example.jelle.bluetoothconnector W/System.err? at java.lang.reflect.Method.invoke(Native Method)
02-19 15:44:17.680    4680-4680/com.example.jelle.bluetoothconnector W/System.err? at java.lang.reflect.Method.invoke(Method.java:372)
Run Code Online (Sandbox Code Playgroud)

谁能帮我?我只需要一些可以通过蓝牙发送/接收字符串的代码来启动我

谢谢!

Kas*_*sra 5

最好,最全面的例子是Android的官方蓝牙聊天示例.您可能不需要更改大部分内容.请看:https: //github.com/googlesamples/android-BluetoothChat